Python- Built in Functions- review help


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)
        return "Nope"


Should there be quotes on the types?


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


Finished it! Thanks!


Thank you very much!


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