I get "Your function fails on is_prime(4). It returns None when it should return False."
Unless I'm missing something, this code should divide 4 / 2 and find it's not a prime. I don't understand why it returns "None".
#Define a function called is_prime that takes a number x as input. #For each number n from 2 to x - 1, test if x is evenly divisible by n. #If it is, return False. #If none of them are, then return True. x=raw_input("Number?") x=int(x) def is_prime(x): if x==1 or x==0: return False if x==2 or x==3: return True if x>3: for n in range(2, x-1): if x % n == 0: return False else: return True is_prime(x)