logo CodeStepByStep logo

if_else_mystery_2

Language/Type: Python if/else mystery

Consider the following function. For each call below, indicate what output is produced.

def if_else_mystery_2(a, b):
    if a * 2 < b:
        a = a * 3
    elif a > b:
        b = b + 3
    if b < a:
        b += 1
    else:
        a -= 1
    print(a, b)

if_else_mystery_2(10, 2)
if_else_mystery_2(3, 8)
if_else_mystery_2(4, 4)
if_else_mystery_2(10, 30)

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.