Just use a dict
to group the results:
>>> result = {}
>>> for letter, number in l1:
... result[letter] = max(number, result.get(letter, number))
...
>>> result
{'A': 9.23, 'B': 6.23, 'C': 10.55}
If you must have a list
, use:
>>> list(result.items())
[('A', 9.23), ('B', 6.23), ('C', 10.55)]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…