If I have code to append 1 list into another:
nlis = [2, 4, 6, 8]
k = []
k.append(nlis)
print(k)
for i in range(4):
nlis[i] += 1
k.append(nlis)
print(k)
For some reason this outputs:
[[2, 4, 6, 8]]
[[3, 5, 7, 9], [3, 5, 7, 9]]
The [2, 4, 6, 8]
becomes [3, 5, 7, 8]
.
How can I make it so that this outputs:
[2, 4, 6, 8]
[[2, 4, 6, 8], [3, 5, 7, 9]]