As expected. I like to work on one problem at a time, test, and continue.

There is no return statement separate from the loop, and the loop does not run if x==0, so the function returns `None`

.

Remove the `else`

and it will return `True`

. Clearly we need to test for 0, or values less than 2.

`if x < 2: return False`

or we could raise a ValueError,

`if x < 2: raise ValueError`

but the SCT will not be able to pass the code if a console error occurs. Best to return False. It's important that this check be before the loop.

```
if x < 2 or x % 2 == 0 and x != 2: return False
if x > 2:
for i in range(3, x):
if x % i == 0: return False
return True
```

The first line tests for both x less than 2, and x is even but not 2. No point checking an even number if we can rule it out without a loop.

The second line prevents 2 from entering the loop. It will default to True.

Inside the loop, we iterate over the range 3..x-1. `i`

will never equal `x`

(range excludes the top value), Only when the loop completes do we return True, never inside the loop.

Test in IDLE

```
>>> def is_prime(x):
if x < 2 or x % 2 == 0 and x != 2: return False
if x > 2:
for i in range(3, x):
if x % i == 0: return False
return True
>>> is_prime(0)
False
>>> is_prime(2)
True
>>> is_prime(3)
True
>>> is_prime(9)
False
>>>
```