2 is even


Replace this line with your code.


def is_even(x):
    x > 0
    if x % 2 :
        return True
        print True
    else :
        return False
        print False


what is the problem?


please how to solve this is -even


you should check if the remainder equals zero.

Or reverse the true and false, for even numbers the remainder is zero, which is considered false, so then else runs, and should return true. and the remainder of a odd number is 1, which is considered true, in which case the if clause runs, and should return false

Multiply ways to solve the problem.


2 posts were split to a new topic: 2. is even


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