Using Loops to track user input

hokiegal99 hokiegal99 at hotmail.com
Mon Jul 7 00:31:51 CEST 2003


You guys are great! Thanks for all the examples.

Cousin Stanley wrote:

> 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
> 





More information about the Python-list mailing list