I am new to python, so would like your help on the matter. I have a list of tuples. I want to group these lists on the basis of the first element of the list, which may repeat. Also, I would like to sum the 2nd and 3rd element of the list for repeating elements.
Sample Input:
[("henry", 10, 20), ("alex", 25, 40), ("henry", 13, 21)]
Sample output:
[("henry", 23, 41), ("alex", 25, 40)]
I have tried the groupby method in python, but it works only on sorted lists.