Review Built-in functions a little stuck


#1


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

I am not really sure where I am going wrong I feel as though my code is correct but I keep getting the following error

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

If anyone can explain to me where I am going wrong, that would be really appreciated.


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


#2

A function ends when the return keyword is reached. Do you see the issue here?


#3

Thank you so much for replying so quickly I saw what my error was. I hadn't;t asked it to return "nope"


#4

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