1.6 what's wrong here?


I'm very stuck here, if someone would be kind enough to help me that would be lovely :slightly_smiling:

Thank you!


if x==2:
return True
if x > 2:

You should know that the function "stops" at the point you "return" something. So your function actually stops at the point you type in 2.
If you type anything greater 2, it will automatically return True, because it won't make it into the third if.

Try it like this instead:

def is_prime(x):
    if x < 2:
        return False
    elif x == 2:
        return True
    elif x > 2:   #You could also use "else" instead
        for x in range (2,(x-1)):
            if x%n == 0:
               return False


thanks for helping but i think that's not it, i still get this error message:

Your function fails on is_prime(3). It returns None when it should return True.