Built In Functions Error- "Fail on Input -10)


#1



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

I am receiving the error:
"You function seems to fail on input -10 when it returned 'None' instead of '10'

I'm not sure why my code will not work...for the life of me cannot figure out what I am doing wrong.

Replace this line with your code. 

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


#2

Did you try to return instead of print?


#3

Just did that. Thank you!


#4

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