# Ghost Game from random import randint print ('Ghost Game') feeling_brave = True score = 0 while feeling_brave: ghost_door = randint (1, 3) print ('Three doors ahead...') print ('A ghost behind one...') print ('Which door do you open?') door = input ('1, 2, or 3?') door_num = int(door) if door == ghost_door: print ('GHOST!') feeling_brave = False else: print ('No ghost!') print ('You enter the next room.') score = score + 1 print ('Run Away') print (' Game over! You scored', score)
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