In this lesson, you’ll learn about the collections.Counter
class. This class is very useful to count the frequency of elements in an iterable. It’s a subclass of dictionary, which makes it simpler to use. Here’s an example:
>>> from collections import Counter
>>> count = Counter("hello")
Counter({'h': 1, 'e': 1, 'l': 2, 'o': 1})
>>> count['l']
2
You can read more about Counter
in the documentation for the Python collections module.
efimius on April 26, 2020
never include links the links under the tutorials.
the other issue I see there is no CC, so I can’t recommend you courses to my wife who is a hard-of-hearing person.
Besides these two issues you and RealPython do a perfect job. I like you guys a lot and always share links on your courses/articles with my colleagues.