Python Practice › Collections Programs › Program 2
Most common letters
Write a Python program to find the 3 most common letters in a word.
Output
[('i', 4), ('s', 4), ('p', 2)]Approach
Counter(word).most_common(3).
Solution
from collections import Counterprint(Counter("mississippi").most_common(3))Output
[('i', 4), ('s', 4), ('p', 2)]Learn the concept
New to this topic? Read the lesson, then come back.