I'm new to python, and lately the following question puzzled me. The correct output is: [1,2,3] Could anyone explain to me why? It's so confusing.
def f(i, values = []):
values.append(i)
return values
f(1)
f(2)
v = f(3)
print(v)
I'm new to python, and lately the following question puzzled me. The correct output is: [1,2,3] Could anyone explain to me why? It's so confusing.
def f(i, values = []):
values.append(i)
return values
f(1)
f(2)
v = f(3)
print(v)