blob: e331cc9f8403ac30d61c9f99df31a086b35b3395 [file] [log] [blame]
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00001#! /usr/bin/env python
Georg Brandl3d072c92009-10-10 21:47:31 +00002
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00003# By GvR, demystified after a version by Fredrik Lundh.
Georg Brandl3d072c92009-10-10 21:47:31 +00004
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00005import sys
Georg Brandl3d072c92009-10-10 21:47:31 +00006
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00007n = 100
Georg Brandl3d072c92009-10-10 21:47:31 +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 Brandl3d072c92009-10-10 21:47:31 +000015
16for i in range(n, 0, -1):
17 print bottle(i), "on the wall,"
18 print bottle(i) + "."
Guido van Rossumb55f9ff1998-12-21 18:30:20 +000019 print "Take one down, pass it around,"
Georg Brandl3d072c92009-10-10 21:47:31 +000020 print bottle(i-1), "on the wall."