Digit to English Word
EasyP3Coding
Return the English word, in lower case, for the last decimal digit of n: "zero", "one", ..., "nine". For a single digit this is just the digit's name; for a larger number it is the word for n % 10. (The original exercise only showed the 0 to 9 mapping, so this version defines it through n % 10.)
Example 1
- Input
- n = 3
- Output
- "three"
Example 2
- Input
- n = 0
- Output
- "zero"
Example 3
- Input
- n = 9
- Output
- "nine"
Constraints
- 0 <= n <= 10^9
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 8. ⌘Enter runs, ⌘⇧Enter submits.