19/19 Functions


#1

Why isn't my code working??
def distance_from_zero(num):
if type(num) == int or float(num):
return abs(num)
elif type(num) == float:
return abs(num)
else:
return "Nope"


#2

Hi, the if statement should be like that if type(num) == int or type(num) == float: and you should remove the else if statement and let only the else statement.


#3

Thank you! ^-^
Finally got it done