我是python的新手,我无法理解下面的第3个输出。 它是如何工作的?
def f(x,l=[]):
for i in range(x):
l.append(i*i)
print(l)
f(2)
f(3,[3,2,1])
f(0)
输出:
[0, 1]
[3, 2, 1, 0, 1, 4]
[0, 1] ---> How does it get the list from the f(2) output?
even though we have changed it with f(3,[3,2,1])