# 99 bottles of beer program def print_a_verse(bottles): bottles_minus=bottles-1 if bottles==1: s="" else: s="s" if bottles_minus==1: t="1 bottle" elif bottles_minus==0: t= "No more bottles" else: t= str(bottles_minus) + " bottles" print str(bottles) + " bottle" + s + " of beer on the wall, "+ str(bottles) + " bottle" + s + " of beer. \n Take one down and pass it around, "+ t + " of beer on the wall." + "\n\n" bottles = 99 print "\n\n\n" while bottles > 0: print_a_verse(bottles) bottles -= 1 print "no more beer go to store"
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question