« Why are people visiting this blog from China? | Main | A thought on Rust and LLMs. »

July 14, 2022

Comments

qsantos

Why not use collections.Counter?


>>> from collections import Counter
>>> Counter([2,1,1,3,4,4,4,4,4,5,5,2,2,2])
Counter({4: 5, 2: 4, 1: 2, 5: 2, 3: 1})

Gary Robinson

Thanks qsantos! In my quest to write about more-itertools, I'd forgotten about that simpler solution. Will update my post.

The comments to this entry are closed.