6. is_prime


#1

Please help me find what's wrong with my code.

Here is my code:

def is_prime(x):
if x < 2 and x > 0:
return False
elif x == 2 or x == 3:
return True
else:
for n in range(2,x):
if x%n == 0:
return False
return True


#2

Thanks.. I figured out!

def is_prime(x):
if x < 2:
return False
elif x == 2 or x == 3:
return True
elif x > 3:
for n in range(2,x):
if x%n == 0:
return False
return True