What happens with my code, guys? I have already set the conditional statement that if x equal to 2, then the function returns True.In fact, it return None.Why is that?
def is_prime(x): if x < 2: return False elif x == 2 and x == 3: return True elif x > 3: for n in range(2,x-1): if x % n == 0: return False else: return True
Your function fails on is_prime(2). It returns None when it should return True.
Replace this line with your code.