Sobes.tech
Junior — Senior

What will the program with a default modifiable parameter print?

livecode

Task condition

What output will appear in the console after executing the following code? The function uses a mutable default argument.

l = [1, 2, 3]
def f(a, L=[]):
    L.append(a)
    return L

f(4)
f(5)
tmp_l = f(6)
print(tmp_l)

f(7, l)
f(8, l)
f(9, l)
print(l)