I have a simple problem: take a number and determine if it is prime. I cannot figure out why on earth the following does not work.
def prime(x):
for i in range (2, x):
if x % i == 0:
return False
return True
prime(21)
This returns true! I have no idea why.