a = [1, 2, 4] b = a b [1, 2, 4] b.append(5) b [1, 2, 4, 5] a [1, 2, 4, 5]
a = 'Hello' b = a b 'Hello' b.append(' World') Traceback (most recent call last): File "", line 1, in AttributeError: 'str' object has no attribute 'append' b = 'hello' a 'Hello' b 'hello'
a = ['foo', 'bar', 'baz'] b = a b ['foo', 'bar', 'baz'] b = [5, 4, 3, 2, 1] a ['foo', 'bar', 'baz'] b [5, 4, 3, 2, 1]
x = [] y = [1, 2, 3] z = (x, y) z ([], [1, 2, 3]) x.append(10) z ([10], [1, 2, 3]) y.remove(2) z ([10], [1, 3])