[Tutor] Python Help

masawudu bature mass02gh at yahoo.ca
Tue Sep 28 06:15:52 CEST 2010


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
            count % n == 1
        return n


### main ####

x = input("Enter a starting value: ")
y = input("Enter a stopping value: ")

count = evenCount(x)

for n in range(x, y+1) :
    count = 0
    if n % 2 == 0 :
        count += n/3
        print "%2d: " %n, "has%2d" %count, "even divisors",
    else :
        print "%2d: " %n, "has 0 even divisors",
    print


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100927/28274bb3/attachment.html>


More information about the Tutor mailing list