Using Loops to track user input
Bob Gailer
bgailer at alum.rpi.edu
Sun Jul 6 19:52:39 EDT 2003
At 02:33 PM 7/6/2003 -0700, Cousin Stanley wrote:
>| Write a program that reads 10 numbers from the user
>| and prints out the sum of those numbers.
Not to neglect the 1-liner:
import operator; reduce(operator.add,[int(raw_input("Number>")) for i in
range(10)])
Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.492 / Virus Database: 291 - Release Date: 6/24/2003
More information about the Python-list
mailing list