Review build in functions


#1




ef distance_from_zero(thing):
if type(thing) == int or type(thing) == float:
    return abs

else:
    return "Nope"
what did I do wrong


#2

abs is a function. What you are returning is the string representation of it, not a value. Invoke the function on your number.

return abs(number)

thing is a poor name for a variable. Yes, a number might be called a thing, but wouldn't it just be simpler to call it what it is? number, or simply, n?


#3

Ok, I'll try to do that


#4

There's another error


#5

Too much indentation on else:. LIne it up with the if.


#6

Ok, thank you, that worked


#7

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