This site is an archive; learn more about 8 years of OpenHatch.

[Pdxpw-staff] '99 bottles of beer' as a loop

Selena Deckelmann selena at chesnok.com
Fri Jul 27 20:40:00 UTC 2012


Thanks!

This reminded me of a little project Ward Cunningham has been noodling on:

http://ward.fed.wiki.org/view/99-bottles-of-beer

The example in coffescript is terrible, but proof that great minds think alike!

-selena

On Fri, Jul 27, 2012 at 1:21 PM, Barbara Shaurette
<barbara.shaurette at gmail.com> wrote:
> def bottles():
>   for i in reversed(range(100)):
>     if i > 0:
>       print i, "bottles of beer on the wall,", \
>         i, "bottles of beer"
>       print "Take one down, pass it around,", \
>         i-1, "bottles of beer on the wall\n\r"
>
> Or, if you want to get fussy about the pluralization:
>
> def bottles():
>   for i in reversed(range(100)):
>     if i > 0:
>       b = "bottles"
>       if i == 1: b = "bottle"
>       print i, b, "of beer on the wall,", \
>         i, b, "of beer"
>       print "Take one down, pass it around,", \
>         i-1, "bottles of beer on the wall\n\r"
> _______________________________________________
> Pdxpw-staff mailing list
> Pdxpw-staff at lists.openhatch.org
> http://lists.openhatch.org/mailman/listinfo/pdxpw-staff



-- 
http://chesnok.com


More information about the Pdxpw-staff mailing list