I have a dict which has (sourceIP, destinationIP) as key and (number_of_packets) as value. The dict output is as follows
New dictionary contents
Key : Value
('A', 'B') : 400
('B', 'A') : 500
('A', 'C') : 10
('C', 'A') : 20
I need to iterate through the keys of the dict and check if the 1st element(sourceIP) in 1st key is the 2nd element(destinationIP) in the 2nd key. If yes, then I should add the value of d[k1] and d[k2] and delete the 2nd row in dict. i.e Instead of having A --> B = 400 and B --> A = 500, I should only have A -- B = 900. Please suggest me how I should iterate through the keys of dict and in that check the elements of tuple?