Review: Built-in Functions


#1

"Oops, try again. Your function seems to fail on input -10 when it returned 'Nope' instead of '10'"

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

Can't find what is wrong.


#2

why are "int" and "float" string? you should check if n is of type float or type int


#3

Oh, that fixed it. Thanks a lot!


#4