【发布时间】:2016-02-08 22:41:16
【问题描述】:
我希望能够将其打印到文本文件中,但是我环顾四周,无法弄清楚我需要做什么。
def countdown (n):
while (n > 1):
print('\n',(n), 'Bottles of beer on the wall,', (n), 'bottles of beer, take one down pass it around', (n)-1, 'bottles of beer on the wall.')
n -= 1
if (n == 2):
print('\n',(n), 'Bottles of beer on the wall,', (n), 'bottles of beer, take one down pass it around', (n)-1, 'bottle of beer on the wall.')
else:
print ('\n',(n), 'Bottle of beer on the wall,', (n), 'bottle of beer, take one down pass it around no more bottles of beer on the wall.')
countdown (10)
【问题讨论】:
-
我环顾四周,你有什么尝试? SO 不是代码编写服务。请解决您的问题并返回一些代码。
-
如果你浏览网页来获得这个问题的答案会很好
标签: python file python-3.x text python-3.5