Help with function


#1

so i have to create a function that gest an argument and if its int or float i have to return the absolute value of it, i dont see what's wrong about the code, yet i get this message:
"Your function seems to fail on input -10 when it returned 'nope' instead of '10'"

My code:
def distance_from_zero(tei):
if tei == int:
return abs(tei)
elif tei == float:
return abs(tei)
else:
return 'nope'

here is a print:


#2

To check the data type we use the Python built-in function, type()...

if type(tei) == int or type(tei) == float:
    return abs(tei)
else:
    return "Nope"

Aside:

The error message contains some Portuguese text. Are you working on the English language course, or not? If so, then navigate to the your Learn page and scroll to the bottom. At lower right, set the pull-down menu to English.