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.

 

Good luck,

 

Robert

 

From: tutor-bounces+bermanrl=cfl.rr....@python.org
[mailto:tutor-bounces+bermanrl=cfl.rr....@python.org] On Behalf Of masawudu
bature
Sent: Tuesday, October 26, 2010 4:20 PM
To: tutor@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:

 

5
3

11
3
7
3
5
5
11
7

7

...

How do i sum them up so that the output will be ,

5 :  15

3 :   9

11:  22

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! 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to