Using Loops to track user input

Cousin Stanley CousinStanley at hotmail.com
Sun Jul 6 17:56:40 EDT 2003


hokiegal ...

Another way if you also wish to save the input numbers ...

nLoops    = 10

list_nums = []

for i in range( nLoops ) :

    this_num = int( raw_input( 'Enter an Integer :  ' ) )

    list_nums.append( this_num )

total = reduce( int.__add__ , list_nums )

print
print list_nums
print
print total

-- 
Cousin Stanley
Human Being
Phoenix, Arizona






More information about the Python-list mailing list