Most common letters

EasyCollections Programs · 2 of 20

Write a Python program to find the 3 most common letters in a word.

Advertisement
Output
[('i', 4), ('s', 4), ('p', 2)]

Approach

  1. Counter(word).most_common(3).

Solution

Python
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.

More collections programs

← All 20 Collections Programs

Leave a Comment