Unvaried error


#1



https://www.codecademy.com/courses/python-beginner-c7VZg/4/3?curriculum_id=4f89dab3d788890003000096#

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))
    else:
        return"Nope"
distance_from_zero(-10)


#2

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


#3

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