I have this code:
x = 'x'
y = []
y.append(x)
z = y
z.append('a')
x = 'X'
print "x:", x
print "y:", y
print "z:", z
output:
x: X
y: ['x', 'a']
z: ['x', 'a']
I know that this is the correct output, but I am having a hard time understanding why it produces
y: ['x', 'a']
instead of
y: ['x']