Float object is not callable


I am on Functions -19/19, trying out the exercise in this page.

This the function I wrote:

def distance_from_zero(sth):
if type(sth) == int or type(sth) == float:
return abs(sth)
return "Nope"

I see the error as:
Oops, try again. It looks like you have a TypeError. Make sure your function should only take one input. (Or check the error message for more info.) - 'float' object is not callable

I tried changing this line from: if type(sth) == int or type(sth) == float:
to 1: if type(sth) == int(sth) or type(sth) == float(sth):
2: if type(sth) == "int" or type(sth) == "float":

none of them worked. Also abs(1.2344) fails too.

Any help is appreciated.



Hmmm... I refreshed the screen (Control+F5) and then, it started working...
This thread can be closed.


def distance_from_zero(dist):
if type(dist)==int:
return dist
elif type(dist)==float:
return dist
return "Nope"