Is prime


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]

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


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

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


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

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


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