You change your list using the operator - L[a][b] = L[a][b] + L[a][b]
for example -
L = [[1, 2, 3], [4, 5, 6], [3, 4, 6]]
L[0][0] = 1
initially Then you change it as L [0] [0] = 2
L = [[2, 2, 3], [4, 5, 6], [3, 4, 6]]
In the next cycle, you index search index 2, which is now 0.0, because you changed the list L. I tried to print L along with a, b in your example. The result explains the behavior -
0 0 [[1, 2, 3], [4, 5, 6], [3, 4, 6]] 0 0 [[2, 2, 3], [4, 5, 6], [3, 4, 6]] 0 2 [[4, 2, 3], [4, 5, 6], [3, 4, 6]] 1 0 [[4, 2, 6], [4, 5, 6], [3, 4, 6]] 1 1 [[4, 2, 6], [8, 5, 6], [3, 4, 6]] 1 2 [[4, 2, 6], [8, 10, 6], [3, 4, 6]] 2 0 [[4, 2, 6], [8, 10, 12], [3, 4, 6]] 2 1 [[4, 2, 6], [8, 10, 12], [6, 4, 6]] 2 0 [[4, 2, 6], [8, 10, 12], [6, 8, 6]]