Reveiw: Built-in Functions confusion


def distance_from_zero('arg'):
if type('arg') == int
return abs('arg')
elif type('arg') == float
return abs('arg')
return "Nope"

Not sure why this isn't working. Comes back with an error of:
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.


Try taking away the quotes from arg. They are unnecessary because arg is an argument for the function distance_from_zero.


Thanks! Worked when i put semicolons in after the if, elif and else!


Working without single quotes.