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

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

Barbara Shaurette barbara.shaurette at gmail.com
Fri Jul 27 20:45:31 UTC 2012


Oh that's awesome.  Also, ha, I screwed up the pluralization - I
totally forgot about the second-to-last verse.


On Fri, Jul 27, 2012 at 1:40 PM, Selena Deckelmann <selena at chesnok.com> wrote:
> 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