What is happening is that when the line below runs:

```
for n in range(2,x):
if (x % n) == 0:
return False
else:
return True
```

The program will only ever check if x % 2 is true when n = 2. Therefore, all composite numbers that do NOT have the number 2 as a factor will `return True`

. This is because this for statement will only ever run one time-- it will `return False`

if itâ€™s divisible by 2 and return True if this is not the case. I understand why this is happening, but I canâ€™t quite articulate it, so hereâ€™s the code with changes made by me:

```
def is_prime(x):
if x < 2:
return False
elif x == 2:
return True
else:
for n in range(2,x):
if (x % n) == 0: # checks if x is divisible by n
return False
elif n == x - 1: # checks if x is divisible by x-1 (the highest value n can ever take on)
return True
else: # if x is not divisible by n and the value of n has not yet reached x - 1,
continue
```

**IF**: checks if x is divisible by n

**ELSE IF**: checks if x is divisible by x-1 (the highest value that n can ever take on)

**ELSE**: if x is not divisible by n and the value of n has not yet reached x - 1, continue the loop (This isnâ€™t necessary)