Same assignment, different problem.
Somehow it stops giving the right answer for number 9?
def is_prime(x): if x == 0 or x == 1: return False elif x == 2: return True else: for n in range(2,x): if x % n == 0: print "not a prime" return False else: return True
If x is 9, and n is picked from 2 to 9, as it starts dividing through numbers, as soon as it encounters 3 it should say 9 % 3 == 0, and print "not a prime" and return False. But I keep getting this error:
Oops, try again. Your function fails on is_prime(9). It returns True when it should return False.