I have a question about dicts, there is a code like below. I have no idea why variable 'a' is changed.
b = []
a = [(1, {"name":"test1"}), (2, {"name":"test2"})]
for i in a:
x, y = i
x["name"] = "test3"
b.append(x)
After above codes, a = [(1, {"name":"test3"}), (2, {"name":"test3"})]
i think i didn't understand logic of dicts. Can you explain me how this happen? And i dont want main list to change, is there another way?