mutable and immutable data

Run Settings
LanguagePython
Language Version
Run Command
l = [[1,2]] x= l +l print(x, id(x[0]), id(x[1])) # [[1, 2], [1, 2]] 4567890123 4567890123 # Same `id`, meaning shared reference x[0][0] = 10 # x> [[1, 2], [1, 2]] -- x[0] > [1,2] -- x[0][0]> 1 # Since x[0] and x[1] refer to the same inner list, modifying one affects both. print(x)
Editor Settings
Theme
Key bindings
Full width
Lines