So basically the bug that I found was about adding a number to a sub-list.
If you declare li1 as li1=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]] in the code below then the code is working as it should do.
Although if you create the list called li1 with the same way how I did in the code below (which has the same outcome in terms of looking at that 2 dimension list) then the output is different and in fact false.
The code:
li1=[[0]*4]*4 for x in range(4): li1[0][1]+=1 print(li1)
Expected behavior
Expected output:
[[0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
[[0, 2, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
[[0, 3, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
[[0, 4, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
The output that I got:
[[0, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0]]
[[0, 2, 0, 0], [0, 2, 0, 0], [0, 2, 0, 0], [0, 2, 0, 0]]
[[0, 3, 0, 0], [0, 3, 0, 0], [0, 3, 0, 0], [0, 3, 0, 0]]
[[0, 4, 0, 0], [0, 4, 0, 0], [0, 4, 0, 0], [0, 4, 0, 0]] |