Staging
v0.8.1
Revision f5f9d99974febbff6d4d55ef36bbfa0c71ed0738 authored by Barry Warsaw on 12 September 2008, 23:35:48 UTC, committed by Barry Warsaw on 12 September 2008, 23:35:48 UTC
1 parent 1e62aec
Raw File
beer.py
#! /usr/bin/env python
# By GvR, demystified after a version by Fredrik Lundh.
import sys
n = 100
if sys.argv[1:]: n = int(sys.argv[1])
def bottle(n):
    if n == 0: return "no more bottles of beer"
    if n == 1: return "one bottle of beer"
    return str(n) + " bottles of beer"
for i in range(n):
    print bottle(n-i), "on the wall,"
    print bottle(n-i) + "."
    print "Take one down, pass it around,"
    print bottle(n-i-1), "on the wall."
back to top