Create a gist now

Instantly share code, notes, and snippets.

In [1]: l1 = [[[0]*3]*3]*3
In [2]: l1
Out[2]:
[[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
In [3]: l1[0][0][0] = 'x'
In [4]: l1
Out[5]:
[[['x', 0, 0], ['x', 0, 0], ['x', 0, 0]],
[['x', 0, 0], ['x', 0, 0], ['x', 0, 0]],
[['x', 0, 0], ['x', 0, 0], ['x', 0, 0]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment