Question regarding the formatting of Functions 19/19.
My first crack at this problem resulted in the following text:
def distance_from_zero(n): if type(n) == int or float: return abs(n) else: return "Nope"
I see now that the correct code for line 2 should be:
if type(n) == int or type(n) == int float:
However, I would really appreciate if someone could explain why the first example doesnt work
Asking if type(n) is equal to either an integer or a float, seams to logically make sense.