logo CodeStepByStep logo

mystery1

Language/Type: Python recursion recursive tracing

For each call to the following function, indicate what console output is produced:

def mystery1(k):
    if k <= 1:
        print(k, end="")
    else:
        mystery1(k // 2)
        print(" =", k, end="")
mystery1(1)
mystery1(4)
mystery1(16)
mystery1(30)
mystery1(100)

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.