Solved


#1

Hey,
I have a quick question regarding an error message, sincei never saw this one(first post, sry for formating).
Thanks for all the answers in advance :slight_smile:

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/isprime?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>

Did you create a function called is_prime? Your code threw a “global name ‘is_prime’ is not defined” error.

<What do you expect to happen instead?>

Since I don’t get the error when running anywhere else besides here, and the function is running like intended. I expected not to get the massage ^^

def is_prim(x):
    test = 0
    if x > 1:
        for i in range(2, x - 1):
            if (x % i) == 0:
                test += 1
            else:
                pass
    else:
        test += 1
    if test == 0:
        print ("True")
        return True
    else:
        print ("Flase")
        return False  

is_prim(17)

#2

here:

def is_prim(x):

you misspelled is_prime


#3

well that is embarrassing ^^ 2 hours and then this
thanks mate


#4

nothing embarrassing about it, programming is just unforgiving, a typo is enough for an error. Well, we are humans, we make typos


#5