[Tutor] Beer Bottles

Steve Nelson sanelson at gmail.com
Thu Jul 6 10:53:38 CEST 2006


A bunch of my friends and I have been chatting about "99 bottles of
beer" - and how to make the shortest code to do it.  I have:

for i in range(100,0,-1):
   print "%s bottles of beer on the wall, %s bottles of beer\nTake on
down, pass it around.."%(i,i)
print "Go to the store, buy some more"

I'm curious to know other ways to handle this - could it be done
functionally?  How could we obfuscate this (not that we'd want to in
real life)?  Or make it a (close to) one liner?

Thanks.

S.


More information about the Tutor mailing list