#Dragon Cave #Intro -> Generate Cave -> Choose Cave -> Define Dragons -> Play again? #Intro -> Define Dragons -> Generate Cave -> Player Chooses Cave -> If not valid answer Player Chooses Cave -> End -> Play again import random import time def displayIntro: print ('You are in a land full of dragons. In front of you,') print ('you see two caves. In one cave, the dragon is friendly') print ('and will share his treasure with you. The other dragon') print ('is greedy and hungry, and will eat you on sight.') print() def chosenCave(): cave = ' ' while cave != '1' and cave != '2': print ('Which cave will you choose?') cave = input() return cave def checkCave(): print('You approach the cave') time.sleep(2)
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