19. review built in functions


#1



def distance_from_zero(!!):
    if type(!!) == int:
        return abs(!!)
    elif type (!!) == float:
        return abs(!!)
    else:
        return "Nope"


don't know what i am doing wrong error message says
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 'distance_from_zero' is not defined please help


Replace this line with your code.


#2

!! can not be used as variable name. Thus it can't be used as function parameter.

variable can be name with the following characters: a-z and numbers


#4

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