Review: Built-in Functions


"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)
        return "Nope"

Can't find what is wrong.


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


Oh, that fixed it. Thanks a lot!