在改變號碼輸入,並將其轉換爲短格式字尋找幫助:簡短表格編號爲詞的Python
for instance 4,000,000,000 -> 4 Trillion,
ones = ["", "one ","two ","three ","four ", "five ", "six ","seven ","eight ","nine "]
tens = ["ten ","eleven ","twelve ","thirteen ", "fourteen ", "fifteen ","sixteen ","seventeen ","eighteen ","nineteen "]
twenties = ["","","twenty ","thirty ","forty ", "fifty ","sixty ","seventy ","eighty ","ninety "]
thousands = ["","thousand ","million ", "billion ", "trillion ", "quadrillion ", "quintillion ", "sextillion ", "septillion ","octillion ", "nonillion ", "decillion ", "undecillion ", "duodecillion ", "tredecillion ", "quattuordecillion ", "quindecillion", "sexdecillion ", "septendecillion ", "octodecillion ", "novemdecillion ", "vigintillion "]
def wordNumber(number):
number = int(number)
number = str(input("Enter the digits: "))
print(wordNumber(number))
我徹底難倒下一步去哪裏,我已經看了很多的在線程序,用完整的數字(10) - > 10來完成確切的事情。
謝謝,我會告訴你這是如何解決的! – PythonLearner
這是迄今爲止最好的代碼,但我不得不去另一條路線。你能看到我的下一篇文章嗎? – PythonLearner
我發佈了我最近的代碼,因爲我有困難,在這裏:http://www.pythontutor.com/visualize.html#togetherjs=Td1Iwzyix8 – PythonLearner