Distance from zero


#1

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

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


Built in function, distance from zero
#2

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


#3

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

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


#4

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

it seems you the name of your function is wrong


#5

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