Use Counter from Python’s collections module when a sequence needs item frequencies. It behaves like a dictionary while providing counting-oriented operations such as most_common. section 3.17 section 3.26
words = ['this', 'is', 'an', 'elementary', 'test', 'example']
Start with a word list and compare each word by the frequency of its most repeated letter. section 3.16
Find the strongest repeated letter
Counter('abcabcabbbc') produces counts for each letter. most_common(1) returns [('b', 5)], so [0][1] extracts the highest count. Wrap that operation in a key function, then let max choose the word with the greatest result. section 3.17 section 3.17
Useful patterns include:
- Counter(word).most_common(1)[0][1] returns a word’s most frequent letter count. section 3.17
- most_common() returns descending name-and-count tuples; passing n limits the result to n items. section 3.17


