Please solve my issue in python/function/19.Review: Built-In Functions


Oops, try again. Your function seems to fail on input -10 when it returned 'True' instead of '10'

save and submit successfully without return any thing because it doesn't return any result for specific value

Replace this line with your code. 

def distance_from_zero(s):
    return type(s) == int or type(s) == float


We have to check if s is int type or float,if it is then return the absolute value of s.

use if-statement ?


i also use this one but same message shown

def distance_from_zero(s):
if type(s) == int or type(s) == float:
return True
return False



Just one problem, we have to return absolute value of number , right? not a boolean value.. ( return True )


It is working now
thanks sorry it all my mistake in understanding the question


Its happens!:slight_smile: reading instruction and theory of exercise helps a lot ! :slight_smile:


here you go......

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


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