I have 2 list-of-lists
a = [(468, 15), (336, 280), (200, 90), (180, 150), (180, 150), (180, 150)]
b = [(200, 200), (200, 90), (200, 90), (180, 150), (180, 150)]
I want to find elements that are the same between both lists and eliminate them.
b[0] is NOT present in a, only one of b[1] & b[2] is present in a, b[3] and b[4] are BOTH present in a.
I need the maximum occurrence in each list to be sent to another list (the others are counted as repeats) i.e. I need this to be my output
combined = [(468, 15), (336, 280), (200, 200), (200, 90), (200, 90), (180, 150), (180, 150), (180, 150)]
Note: I have gone through solutions but they convert these lists into "sets" which eliminates the 'repeat' occurrences.
Is there a simple way to do this?
Edit: Explanation of how the output was made
(468, 15) occurs 1 time in a.
(336, 280) occurs 1 time in a.
(200, 200) occurs 1 time in b.
(200, 90) occurs 1 time in a, 2 times in b.
(180, 150) occurs 3 times in a, 2 times in b.
The output is the max occurrence between both lists i.e.
(468, 15) once.
(336, 280) once.
(200, 200) once.
(200, 90) twice.
(180, 150) thrice.
Making the list as given in combined