I am having a similar problem.

My code

```
def is_prime(x):
if x == 0 or x == 1:
return False
for n in range(2, x-1):
if x% n == 0:
return False
else:
return True
```

I am having a similar problem.

My code

```
def is_prime(x):
if x == 0 or x == 1:
return False
for n in range(2, x-1):
if x% n == 0:
return False
else:
return True
```

Is_prime

In your code you only look for 0 and 1 as none-prime numbers. But what happens if you put in -2?

and what if the number is `2`

? that will also not work.

Also, in the first run of your loop a return keyword is reached, which means your function ends, which happens in the first run of your loop. You should only return true after the loop has finished running

`x - 1`

is actually part of the excersise.

https://codecademy.com/en/courses/python-intermediate-en-rCQKw/0/6?curriculum_id=4f89dab3d788890003000096