Dictionaries · 8 / 15 Exercise Easy

Letter frequency

Objective

Create a Python program that counts how many times each letter of a text appears.

Instructions

  • Read a text.
  • Convert it to lower case and ignore everything that is not a letter (spaces, numbers and signs).
  • Store in a dictionary each letter and its number of appearances.
  • Show one line per letter, sorted alphabetically, with the format letter: times.
Input
Hola Mundo
Output
a: 1
d: 1
h: 1
l: 1
m: 1
n: 1
o: 2
u: 1

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise