blob: 56eec7b0cbb6f19842eb647432308f7a6711c57b [file] [log] [blame]
Benjamin Peterson90f5ba52010-03-11 22:53:45 +00001#! /usr/bin/env python3
Georg Brandl4630c092009-10-10 21:49:24 +00002
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00003# By GvR, demystified after a version by Fredrik Lundh.
Georg Brandl4630c092009-10-10 21:49:24 +00004
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00005import sys
Georg Brandl4630c092009-10-10 21:49:24 +00006
Guido van Rossumb55f9ff1998-12-21 18:30:20 +00007n = 100
Georg Brandl4630c092009-10-10 21:49:24 +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 Brandl4630c092009-10-10 21:49:24 +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 Brandl4630c092009-10-10 21:49:24 +000020 print(bottle(i-1), "on the wall.")