9 votes

Number to text in Python

one dict or three Using num_to_words_first_numbers, ten_by_ten, and spelled_numbers was an interesting design choice. It is certainly fine to leave it as is. But another approach would pre-populate <...
J_H's user avatar
  • 17.2k
5 votes

Number to text in Python

Prefer better data over additional logic. As you know, the difficulty of the problem lies almost entirely in the numbers less than 20. Your ...
FMc's user avatar
  • 12.6k
4 votes

Number to text in Python

You can do it with a one-liner once defined the initial values: ...
mattiatantardini's user avatar
1 vote

Number to text in Python

dict comprehension with library Using existing libraries, essentially "standing on the shoulders of giants", allows us to create stronger code. num2words is a library to convert numbers to ...
atlvd's user avatar
  • 99

Only top scored, non community-wiki answers of a minimum length are eligible