Problem Statement
How do you get the top 3 most frequent items using Counter?
Explanation
Counter counts hashable items and most_common returns items sorted by frequency. It is concise for word counts and event tallies.
You can also add, subtract, and combine counters when merging tallies from multiple sources.
Code Solution
SolutionRead Only
from collections import Counter
c=Counter('banana')
print(c.most_common(3))