I am currently having trouble with the "is_prime" exercise.
I receive the error that this returns "True" for is_prime(9).
Since I have the program check whether x % n == 0 for n in range(2, x), I would expect that this program would see that 9 % 3 == 0 and thus would not return that 9 is prime. This indicates to me that there is some syntactical error I made somewhere but I am not sure where. Any help would be appreciated.
def is_prime(x): if x == 0 or x == 1: return False if x == 2: return True for n in range(2, x): if x % n == 0: return False else: return True