I do not understand the results of this code:
o = {'x':0, 'y':0}mylist=[]for i in range(6): m = o m['x'] = i m['y'] = i*2 mylist.append(m)print(mylist)
How does mylist
end up with 5 identical elements?
I do not understand the results of this code:
o = {'x':0, 'y':0}mylist=[]for i in range(6): m = o m['x'] = i m['y'] = i*2 mylist.append(m)print(mylist)
How does mylist
end up with 5 identical elements?