Is_even


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/0/2?curriculum_id=4f89dab3d788890003000096#

SyntaxError: invalid syntax


def is_even(X):
    if x % 2 = 0 :
        return true
    else:
        return false


#2

here:

if x % 2 = 0 :

a single equal sign means assign, you want to assign a value of zero to the remainder of x divided by 2?


#3

got it , i found other 2 mistakes

  • the capital X in the function
  • the small letter in "t"rue and "f"alse

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

Thanks !


#4

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