Unvaried error



Oops, try again. Your function seems to fail on input -10 when it returned 'None' instead of '10

My code is correct I have tried distance_from_zero(-10) and it gave me 10 that is correct. but the error says that the code fail for -10
please say what should i do

def distance_from_zero(num):
    if  type(num) == int or type(num) == float:
        print(abs(nPreformatted textum))


assuming Preformatted text is a copy paste mistake or something (going on your error message), the problem is that you print the absolute value of num, you don't return the absolute value of num


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