Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Convert and Aggregate by Moff
def conv_aggr(data: list[tuple[str, int]]) -> dict[str, int]:
result = dict()
for k, v in data:
result[k] = v + result.get(k, 0)
return {k: v for k, v in result.items() if k and v}
Sept. 10, 2022
Comments: