```
def is_prime(x):
n =2
while 2 <= n <= x-1 and 2 <= x:
if x < 2 :
return False
elif x % n == 0 and x == n:
print x
return False
x += 1
else:
print x
return True
x += 1
n += 1
Heading
```

# Is_prime, error-Oops, try again. Your function fails on is_prime(0). It returns None when it should return False

**shivani7**#1

**shivani7**#2

You are somewhat overthinking this. Try following this template:

```
def FUNCTION(PARAMETER):
if PARAMETER < INTEGER:
return BOOLEAN
elif PARAMETER >= INTEGER:
for INDIVIDUAL_ITEM in range(INTEGER, PARAMETER - 1):
if PARAMETER % INDIVIDUAL_ITEM == 0:
return BOOLEAN
else:
return BOOLEAN
```

If you have any questions at all on how or why this works, please just ask.

**jamorales**#4

I used this same method and the function doesn't work when the parameter is 4 it returns the wrong boolean value

You probably made a syntax error somewhere. I'll need to see your code if I am going to help you fix it.

**system**#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.