Is_prime WHAT IS WRONG!


#1



I keep getting this error: line 4, return is outside function
If I did it right, then, what is the problem?
Heres my code:


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


#2

this is currently your function + content:

def is_prime(x):
    x = abs(x)

the rest is outside of the function, why?


#4

Oh, I get it now. I forgot to indent. Thanks!


#5