I've been working on is_prime for a while now, and I don't understand what is wrong with my code. It tells me that is_prime(2) returns None instead of False.
I made special cases for all x below 2, and used a while loop to check if x divided by some number n is zero or not. There are return statements and everything. What is structurally wrong with this code that makes it not return True or False?
def is_prime(x): if x <= 1: return False else: n = 2 while n < x: if x%n==0: return False break else: n += 1 return True