Error: "maximum recursion depth exceeded" HELP!



Error Message: "Oops, try again. cube(1) resulted in an error: maximum recursion depth exceeded"

I'm not sure what i'm doing wrong. Does anyone know what the "Maximum recursion depth" is or how i can avoid "exceeding" it?

def cube(number):
    return cube (number*number*number)
def by_three(number):
    if number / by_three:
        return cube(number)
        return False


Hi @couign,

The cube function calls itself here, and that is the cause of the problem ...

    return cube (number*number*number)

A function's calling itself is a recursion, and that should not be done here.

There is an additional problem to address in this line ...

    if number / by_three:


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