I've already solved this exercise inefficiently using the Sieve of Erastothenes, but I'm trying again with the instructions provided. I think I'm 90% of the way there.
Whenever I run the code, I get:
"Oops, try again. Your function fails on is_prime(0). It returns None when it should return False. "
I think the code runs into trouble as it tries to divide by zero and results in 'None', can anyone help me out?
def is_prime(x): for n in range(2, int(x - 1)): if n <= 0 or x <= 0: return False else: if x % n == 0: return False else: return True