Help understanding list operatoins inside functions in python 3
stephen.boulet at gmail.com
stephen.boulet at gmail.com
Tue Jan 13 07:51:19 EST 2015
I'm a bit confused why in the second case x is not [1,2,3]:
x = []
def y():
x.append(1)
def z():
x = [1,2,3]
y()
print(x)
z()
print(x)
Output:
[1]
[1]
More information about the Python-list
mailing list