19/19 Functions


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)
return "Nope"


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.


Thank you! ^-^
Finally got it done