Is prime


#1

HI, You've given a solution for is_prime but I can't get it out from the error.Please can you help me.


6/15 is_prime [Solved]
#2

Please make your own topic with code + question + error message, the response times on the forums are good, someone will help you


#3

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

The error is:Oops, try again.
Your function fails on is_prime(0). It returns None when it should return False.


#4

I am not going to answer that, i already did:

2 is bigger then -1, so the loop won't run


#5

5 posts were split to a new topic: [solved] is prime