logo CodeStepByStep logo

recursion_mystery5

Language/Type: Python recursion

For each of the calls to the following recursive function below, indicate what value is returned:

def recursion_mystery5(a, b):
    if a < 10 or b < 10:
        return a + b
    elif a > b:
        x = recursion_mystery5(a // 2, b // 2)
        y = recursion_mystery5(b, a - b)
        return x + y
    else:
        return recursion_mystery5(a, b // 2)
recursion_mystery5(11, 18)
recursion_mystery5(26, 12)
recursion_mystery5(32, 48)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.