🧮 collections.Counter in #Python makes counting easy!

It's a dict subclass for counting hashable items:

```

from collections import Counter

c = Counter('banana')

# Counter({'a': 3, 'n': 2, 'b': 1})

```

Great for frequency analysis, top elements, and more.

Reply to this note

Please Login to reply.

Discussion

No replies yet.