Stuck on the is_prime exercise. Really have no idea why the code isn't working, would very much appreciate any guidance.
Error message is: Your function fails on is_prime(9). It returns True when it should return False.
I don't know why 9 returns true—as far as I can tell it should break when 9%3 == 0 and returns False. Does this mean there is a problem with my understanding of range? Or something completely different? XD
def is_prime(x): if x < 2: return False elif x == 2: return True else: for n in range(2,x): if x%n == 0: return False break else: return True