[Tutor] Python Help
steve at pearwood.info
Tue Sep 28 13:16:00 CEST 2010
On Tue, 28 Sep 2010 02:15:52 pm masawudu bature wrote:
> 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
I don't understand the question. What do you mean by "divisors the range
has"? Perhaps you should show an example, and give the answer you
This function is troublesome:
> def evenCount(b) :
> for n in range(x, y+1) :
> count = 0
> if n % 2 == 0 :
> count += n/3
> count % n == 1
> return n
What's b? It is never used.
Every time through the loop, you start the count at zero again.
This function will always return y, the stopping value.
More information about the Tutor