My code returns the following error:
Oops, try again. Your function fails on is_prime(2). It returns None when it should return True.
I expect it to work. I cannot see why it doesn't work. I have consulted other similar topics, haven't found the answer there. A nudge in the right direction would be great. Otherwise, I fear I could stare at it forever and not figure it out.
def is_prime(x): if x < 2: return False for n in range(2, x): if x % n == 0: return False else: return True