Returning an error


#1

def distance_from_zero(n):
if type(n) == int or type(n) == float:
return abs(n)
else:
return "nope"

error comes up saying
Your function seems to fail on input -10 when it returned 'Nope' instead of '10'

Anyone know why?


#2

Helps if people can test your code. Make sure it's intact.

If there's an error message in the console that means your code crashed, tend to that first.