Down below is my code. It says that 9 returned True when it should've returned false. If I add an exception and say that if x == 9 return False, it goes until 15 and says the same thing. It returns True when it should've been False. I can't see how it's coming up with that. When it does 9%3 is it not getting 0?? It does this for 9, 15, 21, and 25 and most likely more if I kept going.
def is_prime(x): r = range(1,(x+1)) if x == 0 or x == 1: return False if x == 2: return True else: for n in (r): while n > 1: if x%n == 0: return False else: return True