Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1-liner: three uses of itertools, one counter solution in Clear category for Aggregate and Count by Phil15
import itertools as it
from collections import Counter
def aggregate_and_count(iterable):
return Counter(it.chain.from_iterable(it.starmap(it.repeat, iterable)))
July 17, 2021
Comments: