[Tutor] Summing up numbers in a file

2010-10-26 Thread masawudu bature
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

Re: [Tutor] Python Help

2010-09-28 Thread masawudu bature
don't know how to write a code to count the number of divisors From: David Hutto smokefl...@gmail.com To: masawudu bature mass0...@yahoo.ca Cc: tutor@python.org Sent: Mon, September 27, 2010 11:36:05 PM Subject: Re: [Tutor] Python Help On Tue, Sep 28, 2010 at 12:15

[Tutor] Python Help

2010-09-27 Thread masawudu bature
I'm having a hard time finding the count of divisors that are even. Help anybody? Here's my code. The output is suppose to count the number of even divisors the range has. def evenCount(b) : for n in range(x, y+1) : count = 0 if n % 2 == 0 : count += n/3