2010-03-11 22:53:45 +00:00
|
|
|
#! /usr/bin/env python3
|
2009-10-10 21:49:24 +00:00
|
|
|
|
1998-12-21 18:30:20 +00:00
|
|
|
# By GvR, demystified after a version by Fredrik Lundh.
|
2009-10-10 21:49:24 +00:00
|
|
|
|
1998-12-21 18:30:20 +00:00
|
|
|
import sys
|
2009-10-10 21:49:24 +00:00
|
|
|
|
1998-12-21 18:30:20 +00:00
|
|
|
n = 100
|
2009-10-10 21:49:24 +00:00
|
|
|
if sys.argv[1:]:
|
|
|
|
n = int(sys.argv[1])
|
|
|
|
|
1998-12-21 18:30:20 +00:00
|
|
|
def bottle(n):
|
|
|
|
if n == 0: return "no more bottles of beer"
|
|
|
|
if n == 1: return "one bottle of beer"
|
|
|
|
return str(n) + " bottles of beer"
|
2009-10-10 21:49:24 +00:00
|
|
|
|
|
|
|
for i in range(n, 0, -1):
|
|
|
|
print(bottle(i), "on the wall,")
|
|
|
|
print(bottle(i) + ".")
|
2007-07-17 20:59:35 +00:00
|
|
|
print("Take one down, pass it around,")
|
2009-10-10 21:49:24 +00:00
|
|
|
print(bottle(i-1), "on the wall.")
|