编写一个程序,接收一个数字,并显示与该数字相等的字母。编写程序以便为Nomadillion (可用)编写程序。对于负数,先写上“负”一词,例如负数(。从��到����数字从��−使用小规模(美国)模式来命名大数字.还有..。用于指名号码
发布于 2022-01-06 09:16:08
这种用法至少有两个库: inflect和num2word。尝试这些例子,从那里您可以扩展程序,以包括负格式。
>>>import inflect
>>>p = inflect.engine()
>>>p.number_to_words(99)
ninety-nine
>>> import num2word
>>> num2word.to_card(15)
'fifteen'
>>> num2word.to_card(55)
'fifty-five'
>>> num2word.to_card(1555)
'one thousand, five hundred and fifty-five'
https://stackoverflow.com/questions/70604749
复制相似问题