6. is_prime


I need help, i really don't know what i'm doing...

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


The else and the statement inside of the else is indented once too far. :slight_smile:


There's something else too, you need an elif statement that says if x is equal to 2, return True.


ok thanks, now it's fixed!!!! :smiley: you're really smart :yum:


Glad you got it fixed, and thank ya :)!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.