# "Review: Built-In Functions"

#1

``````def distance_from_zero(num):
if distance_from_zero(num):
return abs
else:
return "Nope"``````

#2

I think in this condition you have to verify if the numebr ( num ) is float or integer ! Yes ?

#3
`` I think that you are correct, sir.  I am still trying to figure out this module myself.  Here is my code:``

def distance_from_zero(num)int:
if distance_from_zero (num)int:
return "Nope
else:
return abs

Sincerely,

Ian Michael Jones

#4

Maybe you should verify the number then?

Running the same function inside itself with the same argument won't work too well.

#5

this is the completed code:

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

#6
`` Ms. Pezzotta, I ran the code that you posted and I received this error.  "Oops, try again. It looks like you have a NameError. Maybe you forgot to create a function called distance_from_zero? Check the error message for more info! - global name 'distance_from_zero' is not defined."``

Thanks!

Ian Michael Jones

#7

please help i really dont know what happened. any ideas?

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

#8

ok never mind i know what i did now.

#9

get in two ways

That

def distance_from_zero (ps):
if type (ps) == int or type (ps) == float:
return abs (ps)
else:
return "No"

and that

def distance_from_zero (s):
if type (s) == int:
return abs (s)
elif type (s) == float:
return abs (s)
else:
return "No"

#10

that code is completely correct just check your spell or common mistaks and make sure if and else both have the returns....

#11

I tried and it didn't work at all