Functions 19. Review Abs() error


#1



https://www.codecademy.com/en/courses/python-beginner-c7VZg/4/3?curriculum_id=4f89dab3d788890003000096#
Excercise 19. Review: Built-in Functions

Keep getting an error that it returns nope instead of 10 when -10 is entered


def distance_from_zero(v):
    if type(v) == 'int' or type(v) == 'float':
       # print "%s"%(abs(v))
        return abs(v)
    else:
           return "Nope"


#2

Did you try without quotes on int and float?


#3

I did and that works thanks Alot :slight_smile: