My code seems to be fine, but it says 1 returns true instead of false, AND no matter what number i put in except zero, i get false. I've seen other people's code, and know there is a built in function that makes it easy, but i want to avoid using it. However, my code doesn't work.
I was expecting a true for primes and a false for composites, but it hasn't worked out
def is_prime(x): y = x - 1 if x >= 1: while y >= 2: if x % y == True: return False y -= 1 else: return True if x <= 1: return False print is_prime(11)
I would love some help, thanks.
P.S, i stopped doing codecademy for a long time, so maybe i've forgotten something...