My code for is_prime function is returning the following error: "Your function fails on is_prime(9). It returns True when it should return False."
I expect it iterate through and divide the numbers from 2 to value x - 1 to determine if it is a prime number. I feel like I am so closed but maybe it's how I am iterating n or do I break if statement in my while loop
def is_prime(x): if x < 2: return False elif x == 2: return True n = 2 while n < range(2, x-1): test = x%n if test == 0: return False else: return True n += 1