I would like to ask why the formal parameter of the Python function can be changed sometimes and sometimes not? Forgive me for not knowing how to describe it, so I borrowed the concept of "deep and shallow copy".
def func(x,y,l):
x = y+1
l.append(0)
if "__main__" == __name__:
x=10; y=10; l=[3,2,1]
func (x,y,l)
print (x,y, l)
I would like to ask: after running the function func, why the values of x and y do not change, but l change? Is there any way for
1 to let l remain the same as x and y and release it directly after running the function?
2 is there any way to change x and y like l? Return?
Thank you first!