#Dragon Realm import time import random def intro(): print("You are in a land full of dragons.") print("In front of you there are two doors,") print("The first door has a dragon") print("that will happily share it's hoard with you,") print("In the other there is a dragon") print("that will happily share the inside of it's stomach with you.") print() def choosecave(): cave = '' while cave != '1' and cave != '2': print("Which cave will you go into? (1 or 2)") cave = input() return cave def checkcave(): print("You approach the cave...") time.sleep(3) print("It is damp and creepy...") time.sleep(3) print("A dragon jumps out and...") time.sleep(5) cavenum = random.randint(1,2) if cavenum == cave: print("Gives you his gold.") else: print("Eats you after torturing you...") print("Would you like to play again? (y or n)") input() if input == 'y': intro() choosecave() checkcave() else: input("Press <Enter>") intro() choosecave() checkcave()
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