Sponsored Content
Top Forums Programming Always giving the answers as 1 Post 303036634 by nag_sathi on Friday 5th of July 2019 11:50:42 AM
Old 07-05-2019
Always giving the answers as 1

Hi,

I have wrote a python program to sum the numbers in a list.However its giving answer one.

Please advise.

Code:
MyList = []
Number =  int(input("Please enter number:"))
for i in range(1, Number + 1):  
    value = int(input("Enter Numbers %d:" %i))
MyList.append(value)

total = sum(MyList)

print("Sum of num:", total)

Output

Code:
C:\Practice>py Sumlist.py
Please enter number:4
Enter Numbers 1:1
Enter Numbers 2:2
Enter Numbers 3:3
Enter Numbers 4:1
Sum of num: 1

This User Gave Thanks to nag_sathi For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I Need Some (help)answers Asap

can someone explain the meaning of the following shell commands: 1. who / wc -l 2. who / sort > user_names 3. cat students > new_students 4. current_day='date / cut -cl-3' i would also appreciated if you could tell me some things about the umask 1. what is a good umask value and why? 2.... (2 Replies)
Discussion started by: dakis
2 Replies

2. Shell Programming and Scripting

basic script for yes and no answers

What is the basic syntax for a script that says do you want to do this? y - execute this n - end not y or n - end and print this for example if I want to run this: "Do you want to start this process?" answer if y,Y, or yes then run the following script (do I put the script with... (10 Replies)
Discussion started by: llsmr777
10 Replies

3. Solaris

expecting answers for these questions?

hi all plese clarify me in the following area. 1. What is the default NFS version in solaris 5.10. If it is 3, then why it asks me to specify "-o vers=3" keyword while i am mounting a share from a RHEL 5.1 Server? 2. Can someone give the link to download packages for accessing "ntfs"... (4 Replies)
Discussion started by: kingston
4 Replies

4. UNIX for Dummies Questions & Answers

Question and answers

Hello All, I need to prepare for interview. Can any body help me with interview question and answers pls.. Regards, Sam (2 Replies)
Discussion started by: j_panky
2 Replies

5. Homework & Coursework Questions

Need answers for these shell programs.....

1. Write a shell script to print the file names of all files having .txt extension of a given directory after converting to uppercase letters. The input (directory name) should be given as command line argument. The script will also check whether sufficient arguments are passed or not and whether... (1 Reply)
Discussion started by: sandeep148
1 Replies

6. Homework & Coursework Questions

Need answers for these shell programs.....

1. Write a shell script to print the file names of all files having .txt extension of a given directory after converting to uppercase letters. The input (directory name) should be given as command line argument. The script will also check whether sufficient arguments are passed or not and whether... (2 Replies)
Discussion started by: sandeep148
2 Replies

7. UNIX for Dummies Questions & Answers

Need answers urgently!!

hello guys!! need 1 favour from u all.. Can u jst tell me the answers for these ques?? 1. ls - l _____ : command to return all files that end with single digit and those with TXT extension 2. ls -l report* _______ : command to return all files that start with the word RPT except those with LOG... (1 Reply)
Discussion started by: Gan_7
1 Replies

8. UNIX for Beginners Questions & Answers

Answers for few objective questions.

Hi Unix geniuses, I need your help for the answers of few objective Q&A. i dont know if my answers are correct or not. So i really need your help to provide the answers which will help me in unix programming. (1 Reply)
Discussion started by: Vivekit82
1 Replies
DONKEY(1)																 DONKEY(1)

NAME
donkey - alternative for S/KEY's "key" command. SYNOPSIS
donkey [options] sequence seed donkey -i key [option] sequence seed key -i DESCRIPTION
This manual page documents briefly the donkey, and key commands. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. Instead, it has documentation in /usr/share/doc/donkey donkey is an alternative for S/KEY's "key" command. The new feature that the original key doesn't have is print an entry for skeykeys as follows; kazu 0099 al02004 115d83956f1089b6 Apr 26,1995 22:13:27 This means that donkey is also an alternative for "keyinit". Since the entry is printed to stdout (not to /etc/skeykeys), you can easily sent it to remote operator by e-mail (with PGP signature or something). So, it possible to initiate S/KEY without login from the console of the host. OPTIONS
A summary of options are included below. -n num specify number of keys to be calculated. -f func choose hash function from MD2 , MD4 , and MD5 EXAMPLES
(1) Calculate an One-Time-Password. Execute Donkey with sequence and seed, then input your passphrase. % donkey 80 is12345 Enter passphrase : xxxxxxxxxxxxxxxxxxxxxxx SOFT O SAW SWAB CON RODE You can choose hash function from MD2, MD4, and MD5. % donkey 80 is12345 Enter passphrase : xxxxxxxxxxxxxxxxxxxxxxx SOFT O SAW SWAB CON RODE %donkey -f md5 80 is12345 Enter passphrase : xxxxxxxxxxxxxxxxxxxxxxx LACK WIN ROSE ANNA STUN REEK The default hash function is MD4 due to the historical reason. (2) Calculate some One-Time-Passwords at once. Use -n option. % donkey -n 10 80 is12345 Enter passphrase : xxxxxxxxxxxxxxxxxxxxxxx 71: WORE HELL CUB FAR DORA MALE 72: SAIL DAN DONE BEER DAYS MOS 73: PAN TONE THAT TOUT BURY EST 74: KEN ROAM HEAT NAN MEAN HEN 75: MINI MARS HASH BOTH SITU SING 76: TOW SHIN FLUE ARID AHOY NE 77: SLID LEEK NO TREE STOW BEY 78: RUDY WINE GIFT FUSS AGEE SUE 79: GELD THIN MAID THIN BUD TURF 80: SOFT O SAW SWAB CON RODE Note that though "Enter passphrase" is printed out to stderr, One-Time-Passwords is to stdout. So, you can redirect the output safely. (3) Print skeykeys entry. Use -i option without argments. Then, enter login name, sequence and seed. If you like default value, just type RET. Input your passphrase twice to get the entry. % donkey -i Enter login name [default kazu]: Enter sequence 1 to 999 [default 99]: Enter new seed [default ur18122]: Please choose passphrase between 8 and 256 characters. Enter passphrase : xxxxxxxxxxxxxxxxxxxxxxxxxxx Re-enter passphrase : xxxxxxxxxxxxxxxxxxxxxxxxxxx kazu 0099 ur18122 fc5b023e684968ff Oct 02,1995 16:15:30 WINK SEAM GRAB ROAD HELL FEST BUGS
Things to do: Support other one time passwords such as OTP. Support other secure hash functions. AUTHOR
This program is developed by Kazuhiko Yamamoto <kazu@is.aist-nara.ac.jp>. This manual page was written by Fumitoshi UKAI <ukai@debian.or.jp>, based on documents of this program, for the Debian GNU/Linux system (but may be used by others). October 4, 1995 DONKEY(1)
All times are GMT -4. The time now is 06:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy