Working with list of tuples
I've been trying to solve this, but I just can't figure it out. So, I've a list with tuples, for example: [("Mary", 10), ("John", 45), ("Bradley", 30), ("Mary", 15), ("John", 10)] and what I want to get is a list with also tuples where, if the name is the same, the numbers of those tuples should be added and, if not, that tuple must be part of the final list too, exemplifying: [("Mary",25), ("John", 55), ("Bradley", 30)] I don't know if I explained myself really well, but I think you'll probably understand with the examples. I've tried this, but it doesn't work: test ((a,b):[]) = [(a,b)] test