Built in functions


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.) - 'int' object is not callable
Code: def distance_from_zero(t):
if type(t) == int or type(t) == float:
return t(abs)
return "Nope"
I tried using FireFox Mozilla, Google Chrome and Internet Explorer.


abs() is the function call and should have t as argument, not the other way around like you did


error message: Oops, try again. Your function seems to fail on input True when it returned '1' instead of 'Nope'

def distance_from_zero(num):
if type(num) == int or type(num) == float:
return abs(num)
elif type(num) != int or type(num) != float:
return abs(num)
return "Nope"


why do you have an elif condition?


Just realized I read the instructions wrong. Got it by simply taking the elif out. noob mistake, thanks!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.