Sobes.tech
Junior — Senior

Mutable object as a default parameter

livecode

Task condition

Behavior of the function when called twice in a row, with its default parameter being a mutable data type.

def f(elements=[]):
    for i in range(4):
        elements.append(i)
    return elements

a = f()
a = f()
print(a)