]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | #! /usr/bin/env python\r |
2 | \r | |
3 | # By GvR, demystified after a version by Fredrik Lundh.\r | |
4 | \r | |
5 | import sys\r | |
6 | \r | |
7 | n = 100\r | |
8 | if sys.argv[1:]:\r | |
9 | n = int(sys.argv[1])\r | |
10 | \r | |
11 | def bottle(n):\r | |
12 | if n == 0: return "no more bottles of beer"\r | |
13 | if n == 1: return "one bottle of beer"\r | |
14 | return str(n) + " bottles of beer"\r | |
15 | \r | |
16 | for i in range(n, 0, -1):\r | |
17 | print bottle(i), "on the wall,"\r | |
18 | print bottle(i) + "."\r | |
19 | print "Take one down, pass it around,"\r | |
20 | print bottle(i-1), "on the wall."\r |