Oops, try again. Your function fails on is_prime(9). It returns True when it should return False.

that make me crazy, i tried every things

def is_prime(x):
    if x < 2:
        return False
    elif x == 2 or x == 3: 
        return True
        for n in range(2, x - 1):
            if x % n != 0:
                return True
                return False


Add prints to your code to investigate what it's doing wrong to get that result:

9 % 2 = 1
9 % 3 = 0
was able to divide, so 9 is not prime


so what i can do to solve this ?


This exercise is a little bit tricky but you are very close.
The range you need to divide the number by itself so x-1 is lower than the number itself

also add prints to make sure where you went wrong as ionatan advised


By investigating what's going on. You can't jump to the fixing part, that's not how any of this works. Find out what you need to fix.


Im not sure it works for is_prime(4)