#import the random module import random # Create a die with 6 sides die_roll=1,2,34,4,4,5,6 # Print random numbers assigned to die_roll print(random.choice(die_roll)) #Results of the die_roll if die_roll==1: print("you lose the game, give me your money") elif die_roll==2: print("free do over") elif die_roll==3: print("you lose the game") elif die_roll==4: print("You lose") elif die_roll==5: print("you still lose the game") elif die_roll==6: print("this game will self-destruct") else: pass
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