I'm not understanding what it is telling me


maximum recursion depth exceeded

It should ether return the absolute value of the variable, or return the statement "Nope"

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


okay well first I'll tell you that you need to use

    if type(x) == int or type(x) == float:

additionally, the reason you're getting the error for the recursion depth exceeding is because you're calling the function from within the function with the if statement, so it's kind of like an infinite loop, just repeating over and over.


Oh, so that's what it was trying to tell me.


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