Reveiw: Built-in Functions confusion


#1

def distance_from_zero('arg'):
if type('arg') == int
return abs('arg')
elif type('arg') == float
return abs('arg')
else:
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.
Help!


#2

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


#3

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


#4

Working without single quotes.


#5