← Back to challenges

Say the Number!

PythonHardalgorithmslogicnumbersdata_structures

Instructions

Create a function that takes a numeral (just digits without separators (e.g. 19093 instead of 19,093) and returns the standard way of reading a number, complete with punctuation.

Examples

say_the_number(0) ➞ "Zero."

say_the_number(11) ➞ "Eleven."

say_the_number(1043283) ➞ "One million, forty three thousand, two hundred and eighty three."

say_the_number(90376000010012) ➞ "Ninety trillion, three hundred and seventy six billion, ten thousand and twelve."

Notes

Must read any number from 0 to 999,999,999,999,999.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.