I have the following kind of list:
myList = [[500, 5], [500, 10], [500, 3], [504, 9], [505, 10], [505, 20]]
I don't want to have values with the same first element, so i wanted to do this: if two or more elements have the same first value, sum all the second values of the element with the same first value and remove the duplicates, so in my example the new output would be:
myList = [[500, 18], [504, 9], [505, 30]]
How can i do this? I was thinking of using Lambda functions but i don't know how to create the function; other solutions i'm thinking about require a massive amount of for loops, so i was thinking if there is an easier way to do this. Any kind of help is appreciated!