Hey I was wondering why this first piece of code is different than the second, the first piece of code takes in True and outputs 1 while the second one correctly outputs "nope". To me both if statements should produce the same output.
1.
def distance_from_zero(Number):
if type(Number) == int or float:
return abs(Number)
else:
return "Nope"
2.
def distance_from_zero(Number):
if type(Number) == int or type(Number) == float:
return abs(Number)
else:
return "Nope"