Display an positive integer as a descriptive numeric string. For example:
Input | Descriptive Numeric String |
---|---|
0 | zero |
120 | one hundred, and twenty |
1024 | one thousand, and twenty four |
23,567 | twenty three thousand, five hundred, and sixty seven |
2000345678 | two billion, three hundred and forty five thousand, six hundred, and seventy eight |
3,000,000,000,036 | three trillion, and thirty six |
a. loop until the users indicates to quit (enters an empty string?)
b. ask the user to enter a positive integer
c. display the integer's descriptive numeric string
d. allow commas in the user's input (see examples)
e. the allowed integer range is 0 to 1 less than 1 quadrillion (10**15 - 1)
f. test for errors in the user's input and display error messages
g. user input must be converted to an integer for processing (do not use the input string)
h. code the program (function) so that it can be imported into another program
use if __name__ == '__main__': for the user input and verification code
i. the main "work" function should be intToDescriptiveNumericString(n)
Names of large numbers (Wikipedia)
1. print trillions, billions, ... hundreds on separate lines
2. Remove "and" but leave spaces in the output string
3. Remove commas from the output string
4. Allow negative integers as input
Reverse project #1. Take an numeric string and convert it to an integer.