If -else


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

the error message says
Have you defined the function distance_from_zero(n)?
But I have done that haven't I?


Why is the else statement indented into the if statement? You also have extra whitespace in the return "Nope" block.


Thanks! It worked out well after your corrections.

Kristian Strid
Lektor i fysik


Great! I'm glad it worked.

Happy Coding,


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