[Tutor] Beer Bottles
Alan Gauld
alan.gauld at freenet.co.uk
Thu Jul 6 13:15:55 CEST 2006
> for i in range(100,0,-1):
> print > 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?
print "".join(['%s bottles of beer on the wall, %s bottles of
beer\nTake on
down, pass it around..'%(i,i) for i in range(100,0,-1)])+ "\nGo to
the store, buy some more"
Is a one liner based on your code...
Not very obfuscated though...
Alan G.
More information about the Tutor
mailing list