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

else:

for n in range(2,x):

if x % n==0:

return False

else:

return True