A frequency table preserves counts that a set would lose. Counter can return ranked entries without a custom counting loop.
Worked example
from collections import Counter
print(Counter([3, 1, 3, 2, 3]).most_common(1))Result
[(3, 3)]Implementation notes
Counting hashable values groups by equality. Normalize casing or whitespace first only if those differences should disappear from the report.
Try it yourself
Add a tie and check whether you need a secondary ordering rule.
Open the Python example →Editorial date March 8, 2026 · Published December 6, 2026