Look at the code below:
def f1(l):
l[0] = 'row'
l[1] = 'col'
return True
def f2():
l = [0,0]
f1(l)
print(l)
f2()
running the f2
function, prints l = ['row', 'col']
. Why did this happen?
My Python version is 3.7.13
Look at the code below:
def f1(l):
l[0] = 'row'
l[1] = 'col'
return True
def f2():
l = [0,0]
f1(l)
print(l)
f2()
running the f2
function, prints l = ['row', 'col']
. Why did this happen?
My Python version is 3.7.13