[Tutor] Summing up numbers in a file
masawudu bature
mass02gh at yahoo.ca
Tue Oct 26 22:20:21 CEST 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101026/1c209365/attachment.html>
More information about the Tutor
mailing list