why doesn't this work?

Replace this line with your code. 
def is_even(x):
    if x % 2:
        return True
    else :
        return False


What about x % 2? Can it have any remainder to be True? Or does the remainder have to equal to 0?
In order for a number to be even, the remainder when x is divided by 2 has to be 0.
That % produces the remainder hence your if statement should be

if x % 2 == 0:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.