is_prime: Can someone tell me what is wrong with my code?


#1

def is_prime(x):
    if x < 2:
        return False
    elif x == 2:
        return True
    elif x > 2:
        num = x - 1
        if x % num != 0 and num > 1: 
            return False
            num -=1
        elif x % num == 0:
            return True

#3

You don't have any loop in there, so you'll just have one iteration. That means you'll get 6 being returned as a prime - which obviously it's not.
Maybe think about using a for or a while loop?