I'm not understanding what it is telling me


#1




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


#2

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.


#3

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


#4

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