code
lst = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
for i in lst:
i.append(0)
makes lst look like this
[[1, 2, 3, 0], [4, 5, 6, 0], [7, 8, 9, 0]]
The result is unexpected for me, since usually when we loop through a list, in i we seem to get a *copy *of the next value. I mean, code
for i in lst:
i = 3
doesn't change anything in the lst, so in every iteration i is just a temporary copy, right?