19. Review: Built-In Functions fails on input -10


Hello There,

I am getting the following error:
Your function seems to fail on input -10 when it returned ‘Nope’ instead of ‘10’

I run out of ideas. My code is:

def distance_from_zero(s):
  if type(s) == int(s) or type(s) == float:
    return abs(s)
    return "Nope"

Do you have any clue what’s wrong?



We do not want to compare to a function, but a class.

... == int


Brilliant, thank you!


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