Review: Built In Functions---Please Help


This is the error I keep receiving:

Oops, try again. It looks like you have a NameError. Maybe you forgot to create a function called distance_from_zero? Check the error message for more info! - global name ‘math’ is not defined

Does anyone know what is wrong? Please help! This is my code:

def distance_from_zero(number):
    if type(number)==int or type(number)==float:
        return math.abs(number)
        return "Nope"


abs() is a so-called built-in function.

Thus remove the math library-keyword…!!


You are getting error because in your snip-code
“return math.abs(number)”
Just try
return abs(number)


Thanks! This was very helpful.