Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
459 bytes
|
Rev | Line | |
---|
[2] | 1 | #! /usr/bin/env python
|
---|
[391] | 2 |
|
---|
[2] | 3 | # By GvR, demystified after a version by Fredrik Lundh.
|
---|
[391] | 4 |
|
---|
[2] | 5 | import sys
|
---|
[391] | 6 |
|
---|
[2] | 7 | n = 100
|
---|
[391] | 8 | if sys.argv[1:]:
|
---|
| 9 | n = int(sys.argv[1])
|
---|
| 10 |
|
---|
[2] | 11 | def 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"
|
---|
[391] | 15 |
|
---|
| 16 | for i in range(n, 0, -1):
|
---|
| 17 | print bottle(i), "on the wall,"
|
---|
| 18 | print bottle(i) + "."
|
---|
[2] | 19 | print "Take one down, pass it around,"
|
---|
[391] | 20 | print bottle(i-1), "on the wall."
|
---|
Note:
See
TracBrowser
for help on using the repository browser.