I am trying to create a list filled with dictionary so that I can update each related dictionaries for making and adjacency list for a Graph. However, like below, whenever I try to update the dictionary, every dictionary in the array gets updated when I only want that specific dictionary in that related index to be updated. Does making dictionaries inside a list create duplicate dictionaries? How can I get around with this problem?
>>> a = [{}] * 4
>>> a[0].update({1:4})
>>> a
[{1: 4}, {1: 4}, {1: 4}, {1: 4}]