I'm trying to create a new list by changing the other in for loop, using append method. But I a have a trouble with it.
My simple code:
l1=[]
l2=[0,0]
for i in range(4):
l2[0]+=1
l1.append(l2)
print l2
print l1
Return:
[1, 0]
[2, 0]
[3, 0]
[4, 0]
[[4, 0], [4, 0], [4, 0], [4, 0]]
But I expected that list l1 would be like this: [[1,0], [2,0], [3,0], [4,0]] Where I made a mistake?