Dictionaries · 15 / 15 Exercise Medium

Number to text

Objective

Create a Python program that writes each digit of a number in words, using a dictionary.

Instructions

  • Create a dictionary that relates each digit (as text, "0" to "9") to its name: zero, one, two, three, four, five, six, seven, eight, nine.
  • Read a non-negative integer, as text.
  • Show on a single line the name of each digit, separated by a space.
Input
2026
Output
two zero two six

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

Start exercise