logo CodeStepByStep logo

loop_mystery_exam3

Language/Type: Python while return

For each call of the function below, write the output that is printed and the value that is returned:

def loop_mystery_exam3(x, y):
    z = x + y
    while x > 0 and y > 0:
        x = x - y
        y -= 1
        print(str(x) + " " + str(y) + " ", end="")
    print(str(y))
    return z
loop_mystery_exam3(7, 5) output
loop_mystery_exam3(7, 5) return
loop_mystery_exam3(20, 4) output
loop_mystery_exam3(20, 4) return
loop_mystery_exam3(40, 10) output
loop_mystery_exam3(40, 10) return

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.