19. Review: Built-In Functions


What's wrong with my code?

def distace_from_zero(num):
    if type(num) == int or type(num) == float:
        return abs(num)
        return "Nope"

It returns > Oops, try again. Your function seems to fail on input True when it returned '1' instead of 'Nope'


Maybe it's asking you to switch the outputs: to return "Nope" when it's True, and to return abs(num) when it's False.


Hi @nikdj ,

Rename your function and submit it again. You have ...

def distace_from_zero(num):

Codecademy probably remembers a previous incorrect version of your function that had the correct name.


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