logo CodeStepByStep logo

loop_mystery_exam5

Language/Type: Python while return

For each call of the function below, write the output that is printed as it would appear on the console.

def loop_mystery_exam5(x, y):
    z = y
    while x % z == 0:
        print("(" + str(x) + " " + str(z) + ") ", end="")
        x = x - z
        z += 1
    print("(" + x + " " + z + ") " + str(y))
loop_mystery_exam5(12, 4)
loop_mystery_exam5(14, 2)
loop_mystery_exam5(27, 3)

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.