Python- Built in Functions- review help


#1





Hi, my program keeps telling me that it returns "Nope" instead of 10 when -10 is inputed


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


#2

Should there be quotes on the types?


#3

Hey there. type(object) returns a type, not a string. :slight_smile:


#4

Finished it! Thanks!


#5

Thank you very much!


#7

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