Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # gets the number
- numb = input('what number wouldyou like to convert to word form? ')
- if len(numb) > 3:
- exit()
- nSplit = []
- tList = []
- Result = ''
- # lists used to label numbers
- basicNumbs= ['one', 'two','three','four','five','six','seven','eigh','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','']
- Tensnumbers = ['Twenty','thirty','fourty','fiffty','sixty','sevendy','eighty','nindy','']
- Advanced = ['hundred','thousand','million']
- # splits your number into its compents ie, 3, 2, 4 for 324
- for n in numb:
- nSplit.append(n)
- #Makes a seperate list for the last two numbers and gets rid of them from the orignal
- for x in range(0 , 3):
- tList.append(nSplit[len(nSplit) + x - 3])
- # finds hte word from for the last two nmbr
- if int(tList[0]) < 2:
- badCodeingLmao = int(tList[0]) * 10
- if int(tList[2]) == 0:
- None
- else:
- badCodeingLmao += int(tList[1]) - 1
- Result += basicNumbs[badCodeingLmao]
- else:
- badCodeingLmao = int(tList[0])-1
- Result+= basicNumbs[badCodeingLmao] + ' hundred '
- badCodeingLmao = int(tList[1]) - 2
- Result+= Tensnumbers[badCodeingLmao] + ' '
- if int(tList[1])== 0:
- badCodeingLmao = 19
- else:
- badCodeingLmao = int(tList[2]) - 1
- Result+= basicNumbs[badCodeingLmao] + ' '
- print(Result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement