import random number_of_rounds = input('How many rounds will be played?') antonia_points = 100 david_points = 100 x = number_of_rounds while x > 0: antonia_roll = random.randrange(6) david_roll = random.randrange(6) if antonia_roll > david_roll: david_points = david_points - antonia_roll number_of_rounds = number_of_rounds - 1 else david_roll < antonia_roll: antonia_points = antonia_points - david_roll number_of_rounds = number_of_rounds - 1 print antonia_points print david_points
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