Distance from zero


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

can anybody tell what is the wrong in htis code??

Built in function, distance from zero

check out this exercise, it teaches about abs(), you return the absolute value


def distance_from_zero(s):
if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown abborted"
return "Sorry"

can anbody tell what is wrong in this code?? its not working.


this looks like a messup of two exercise. Which exercise you at?

it seems you the name of your function is wrong


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