• API
• FAQ
• Tools
• Archive
SHARE
TWEET # NumbersToWordForm(1-999) a guest Nov 14th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # gets the number
2. numb = input('what number wouldyou like to convert to word form? ')
3. if len(numb) > 3:
4.   exit()
5. nSplit = []
6. tList = []
7.
8. Result = ''
9. # lists used to label numbers
10. basicNumbs= ['one', 'two','three','four','five','six','seven','eigh','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','']
11. Tensnumbers = ['Twenty','thirty','fourty','fiffty','sixty','sevendy','eighty','nindy','']
13. # splits your number  into its compents ie, 3, 2, 4 for 324
14. for n in numb:
15.   nSplit.append(n)
16. #Makes a seperate list for the last two numbers and gets rid of them from the orignal
17.
18. for x in range(0 , 3):
19.   tList.append(nSplit[len(nSplit) + x - 3])
20.
21.
22. # finds hte word from for the last two nmbr
23. if int(tList) < 2:
24.   badCodeingLmao = int(tList)  * 10
25.   if int(tList) == 0:
26.     None
27.   else:
28.     badCodeingLmao += int(tList) - 1
30. else:
32.   Result+= basicNumbs[badCodeingLmao] + ' hundred '
33.   badCodeingLmao = int(tList) - 2
34.   Result+= Tensnumbers[badCodeingLmao] + ' '
35.
36.   if int(tList)== 0: