Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Demo/scripts/beer.py

    r2 r391  
    11#! /usr/bin/env python
     2
    23# By GvR, demystified after a version by Fredrik Lundh.
     4
    35import sys
     6
    47n = 100
    5 if sys.argv[1:]: n = int(sys.argv[1])
     8if sys.argv[1:]:
     9    n = int(sys.argv[1])
     10
    611def bottle(n):
    712    if n == 0: return "no more bottles of beer"
    813    if n == 1: return "one bottle of beer"
    914    return str(n) + " bottles of beer"
    10 for i in range(n):
    11     print bottle(n-i), "on the wall,"
    12     print bottle(n-i) + "."
     15
     16for i in range(n, 0, -1):
     17    print bottle(i), "on the wall,"
     18    print bottle(i) + "."
    1319    print "Take one down, pass it around,"
    14     print bottle(n-i-1), "on the wall."
     20    print bottle(i-1), "on the wall."
Note: See TracChangeset for help on using the changeset viewer.