on 19/19 Review:Built-In Functions my code worked, it passed. But I have an understanding question.
First, here is the code I used:
def distance_from_zero(distance): if type(distance) == int or type(distance) == float: return abs(distance) else: return "Nope"
1.Why wouldn't it work if I put a number, instead of a word, for example def distance_from_zero(10):
When I try this, I get the error:
F"ile "python", line 1
SyntaxError: invalid syntax "
2.What should I do to get "Nope" as an output? Where should I "input" the type, so I can get something else than int or float?