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
.
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
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
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
___
Tutor maillist