blob: 8135509522b3fb7bde055362871dbcac734c4763 [file] [log] [blame]
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00001#! /usr/bin/env python
Georg Brandl22fff432009-10-27 20:19:02 +00002
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00003# By GvR, demystified after a version by Fredrik Lundh.
Georg Brandl22fff432009-10-27 20:19:02 +00004
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00005import sys
Georg Brandl22fff432009-10-27 20:19:02 +00006
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00007n = 100
Georg Brandl22fff432009-10-27 20:19:02 +00008if sys.argv[1:]:
9 n = int(sys.argv[1])
10
Guido van Rossumb55f9ff1998-12-21 18:30:20 +000011def bottle(n):
12 if n == 0: return "no more bottles of beer"
13 if n == 1: return "one bottle of beer"
14 return str(n) + " bottles of beer"
Georg Brandl22fff432009-10-27 20:19:02 +000015
16for i in range(n, 0, -1):
17 print(bottle(i), "on the wall,")
18 print(bottle(i) + ".")
Collin Winter6f2df4d2007-07-17 20:59:35 +000019 print("Take one down, pass it around,")
Georg Brandl22fff432009-10-27 20:19:02 +000020 print(bottle(i-1), "on the wall.")