[Tutor] Summing up numbers in a file
bermanrl at cfl.rr.com
Tue Oct 26 22:35:09 CEST 2010
This certainly looks like a classroom assignment. Please make an attempt to
solve the problem on your own. If the program fails, please copy the code you
have written and the error messages from the traceback and someone here will
be more than happy to help you work your way through the problem.
From: tutor-bounces+bermanrl=cfl.rr.com at python.org
[mailto:tutor-bounces+bermanrl=cfl.rr.com at python.org] On Behalf Of masawudu
Sent: Tuesday, October 26, 2010 4:20 PM
To: tutor at python.org
Subject: [Tutor] Summing up numbers in a file
How do I sum all occurrences of a number in a file?
I have a file with a bunch of numbers, each on it's own line:
How do i sum them up so that the output will be ,
5 : 15
3 : 9
7 : 21
I am using the Free version of SPAMfighter <http://www.spamfighter.com/len> .
SPAMfighter has removed 16 of my spam emails to date.
Do you have a slow PC? <http://www.spamfighter.com/SLOW-PCfighter?cid=sigen>
Try free scan!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor