This is my problem:

Define a function called is_prime that takes a number x as input.

For each number n from 2 to x - 1, test if x is evenly divisible by n.

If it is, return False.

If none of them are, then return True.

THIS IS WHAT I WROTE:

def is_prime(x):

if x < 2:

return False

if x == 2:

return True

if x == 3:

return True

for i in range(2, x-1):

if x % i == 0:

return False

else:

return True

What am i doing wrong?

I tried scripts fomr foruns but they did not work