I have a piece of code as below:
def f(x,l=[]):
for i in range(x):
l.append(i*i)
print(l)
f(2)
f(3)
Why it gives as:
[0, 1]
[0, 1, 0, 1, 4]
for f(3) ? why it is storing value of l ? Isn't it supposed to be local temporary variable ?