here is my code:
def is_prime(x):
if x < 2:
return False
else:
for i in range(2,x):
if x % i == 0:
return False
else:
return True
print is_prime(508)
I don't understand why the last else: return true
works with the indentation. If I type
else:
for i in range(2,x):
if x % i == 0:
return False
else:
return True
Then def is_prime(2) returns none? why?