I would do the check for whether x ==2 and x ==3 before your for loop. This is my code below. It keeps failing on is_prime(9). Can anyone spot where I'm going wrong?

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

Is prime

Please read this post about markdown so your code/indent will show.

In your case your loop only runs, (see above) and returns True or False (because if is true, or else will run) either way, the loop runs once, you want to put return True outside the for loop


Thanks! I've been trying to figure that out :slightly_smiling: