99 Bottles of Beer Computer Programs.

By Alex in Music on Nov 27, 2006 at 1:56 am

99 Bottles of Beer website has a collection of 1,031 programs using various computer languages which all generate the lyrics of the song 99 Bottles of Beer.

Here’s the program in python:

#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-

"""
99 Bottles of Beer (by Gerold Penz)
Python can be simple, too :-)
"""

for quant in range(99, 0, -1):
     if quant > 1:
           print quant, "bottles of beer on the wall,", quant, "bottles of beer."
           if quant > 2:
                 suffix = str(quant – 1) + " bottles of beer on the wall."
           else:
                 suffix = "1 bottle of beer on the wall."
     elif quant == 1:
           print "1 bottle of beer on the wall, 1 bottle of beer."
           suffix = "no more beer on the wall!"
     print "Take one down, pass it around,", suffix
     print "–"

Link – via Miss Cellania


Email This Post
Tweet This Post 
Share This Post on Facebook


Neat stuff from the NeatoShop:



Keep track of the comments with Comment RSS

Don't Miss: New Stuff | Bestsellers | The Cute Store
                   Funny T-Shirts

Need a gift? Get unforgettable gifts for:
Geeks | Pranksters | Kids | Hipsters | Shutterbugs

Lijit Search

Old school? Bookmark us! RSS Feed Twitter Facebook Page