In this list of dictionaries, I want to sum up the values
of matching keys so that the output is as seen below:
dict_x = [{(1, 2): 100}, {(1, 3): 150}, {(1, 3): 150, (3, 4): 150}, {(4, 5): 10, (1, 3): 10, (3, 4): 10}, {(5, 6): 15}]
output:{(1, 2): 100, (1, 3): 310, (3, 4): 160, (4, 5): 10, (5, 6): 15}
I have read through some pages like How can I count the occurrences of a list item in Python? and Count how many times a part of a key appears in a dictionary python while they count the occurrence of the matching elements, they do not quite do a multiple summation of matching elements. Thank you for your time.