source: python/trunk/Demo/scripts/beer.py@ 603

Last change on this file since 603 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
Line 
1#! /usr/bin/env python
2
3# By GvR, demystified after a version by Fredrik Lundh.
4
5import sys
6
7n = 100
8if sys.argv[1:]:
9 n = int(sys.argv[1])
10
11def 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"
15
16for i in range(n, 0, -1):
17 print bottle(i), "on the wall,"
18 print bottle(i) + "."
19 print "Take one down, pass it around,"
20 print bottle(i-1), "on the wall."
Note: See TracBrowser for help on using the repository browser.