This is my sample code:
dict1 = {'a': 5, 'b': 6, 'c': 7}
dict2 = dict1
for i in dict1:
dict1[i] += 5
print dict1
print dict2
Output looks like this:
{'a': 10, 'c': 12, 'b': 11}
{'a': 10, 'c': 12, 'b': 11}
Why is dict2 changing without me telling it to?
Python 2.7.10 on GCC 4.8.2 Linux.
Also tried on 2.7.12 on GCC 5.4.0, same result.