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

Dont understend why 9 returns True

def is_prime(x):
    if x > 2:
        for n in range(2, x):
            if x % n == 0:
                return False
                return True
    elif x == 2:
        return True
        return False


lets see, for x=9, agree that the first iteration of the loop this is the if condition:

if 9 % 2 == 0

this condition is false, so else will run. Which returns True. Once a return keyword is reached, the function ends (the loop will break)

You only want to return True after the loop has finished running


got it, Thank You:)))))))))))))))))))))))))