Review buit-in functions


#1

def distance_from_zero(a):
if (a) == int or float :
return abs(a)
else :
return "nope"
Your function seems to fail on input True when it returned '1' instead of 'Nope'


#3

you need to do comparison at both side of the or operator, otherwise python will always evaluate float to true


#4

how do i do that.
do i use <> these symbols


#5

if you want your indent to show up on the forum, select your code and press </> button

this:

is how to solve your problem in the exercise, so you can move on to the next exercise


#6

thanks dude i like how you answered me


#7

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