Hi everyone,

I've been stuck at this problem for a while now since I do not understand what the mistake is in my function (1) everytime I try the problem again I somehow come up with basically the same code. I looked through the forum and saw this code (2) which looks very similar to my own attempt. My question now is, in what way do (1) and (2) differ? "Return True" at the end in (1) is inside the for-loop whereas in (2) it is not but I cannot seem to understand the impact of this.

Thanks in advance**Link to problem**

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

The code gives me an error at x = 2

(1)

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

(2)

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