Consider the following two pieces of code in Python interpreter 3.6-
>>> d = {0:[[1,2],[3,4]]}
>>> d[1] = [[0]*2]*2
>>> d
{0: [[1, 2], [3, 4]], 1: [[0, 0], [0, 0]]}
>>> d[1][0][0] = 5
>>> d
{0: [[1, 2], [3, 4]], 1: [[5, 0], [5, 0]]}
and
>>> d = {0:[[1,2],[3,4]] , 1 : [[0,0],[0,0]]}
>>> d
{0: [[1, 2], [3, 4]], 1: [[0, 0], [0, 0]]}
>>> d[1][0][0] = 5
>>> d
{0: [[1, 2], [3, 4]], 1: [[5, 0], [0, 0]]}
Why are they giving different values of d[1]
when the only difference is the way the list of zeroes is created?