我试图告诉Python将整数转换为单词.
示例:(使用墙上的99瓶啤酒)
我用这段代码编写程序:
for i in range(99,0,-1):
print i, "Bottles of beer on the wall,"
print i, "bottles of beer."
print "Take one down and pass it around,"
print i-1, "bottles of beer on the wall."
print
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何编写程序,以便显示单词(即九十九,九十八等)而不是数字.
我一直令人头我的头在Python书我有,我明白,也许我只是不明白for/ if/ elif/ else循环,但是我只是纺纱我的车轮.
谁能提供任何见解?我不是在寻找一个直接的答案,虽然这可能有助于我看到我的问题,只要指出我正确方向的任何事情都会很棒.
python ×1