this code gives me the error: Your function fails on is_prime(2). It returns None when it should return True.
First, what does is_prime(2) signify?
What I have tried to do was start with an if statement saying returning false if x<2 because a we know that one is not considered a prime number. I read on some other posts that since my for loop is in the range of 2 to x, two drops out and I can return it at the bottom in the last else statement.
number = input('num= ') def is_prime(x): if x < 2: return False else: for num in range(2,x): if x%num == 0: return False else: return True is_prime(number)