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