Review: Built-In Functions


#1

Your function seems to fail on input True when it returned '1' instead of 'Nope'

 def distnace_from_zero(s):  
     if type(s) == int or type(s) == float:
         return abs(s)
     else:
         return 'Nope'

I am 100% sure that my code is correct, nevertheless; I wonder if others have seen the same problem and how did they solve It?

Thanks!


#2

Did you mean to write, distance_from_zero?


#3

Yes, that's a typo error. It should not matter for the computer.

I managed to solve the problem, thanks for the help.