# 6. is_prime

#1

Im just not getting it, im following the instructions but not getting anywhere.

I looked at other peoples answers but doesnt look like the instructions answer.

Replace this line with your code.
def is_prime(x):
y = x-1
for n in range(2, y):
if x % n == 0 and x/x == 1:
return False
print "False"
else:
return True
print "True"
is_prime(2)

#2

so what is your question ? ( also error message if it exist !)

#3

My question is why the code isnt working out

#4

I m just analyzing your code ,

This is always True so why adding it ??

Also if you wanna print something write it before return instruction in function :

You should check the hint :
Remember: all numbers less than 2 are not prime numbers!

#5

i did check the hint and changed my code

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

Im just not getting how to understand it

#6

all numbers less than 2 are not prime numbers!
so we can use a condition that verify if the number entered is less than 2,then the function return False , if not the function will execute the code you wrote

if n>=2:
...
else:
return False