Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Emile van Sebille
On 10/26/2010 1:20 PM masawudu bature said... 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 Well, you'll need to

Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Robert Berman
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.

Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Adam Bark
On 26/10/10 21:20, masawudu bature wrote: 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 Assuming you know how to ite