#!/usr/bin/env python3 def write99(): r = "" for quant in range(99, 0, -1): if quant > 1: r += (str(quant) + " bottles of beer on the wall, " + str(quant) + " bottles of beer.") if quant > 2: suffix = str(quant - 1) + " bottles of beer on the wall." else: suffix = "1 bottle of beer on the wall." elif quant == 1: r += "1 bottle of beer on the wall, 1 bottle of beer." suffix = "no more beer on the wall!" r += ("Take one down, pass it around, " + suffix + "--") return(r) s = input("Enter your H9+ program here: ") o = "" for c in s: if c == "9": r = write99() o += r elif c == "h" or c == "H": o += "Hello World!" print(o)
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