import random AnotherGo = "Yes" def Game(Name): while AnotherGo == "Yes" or AnotherGo == "yes" or AnotherGo == "y": Die1 = random.randint(1,6) Die2 = random.randint(1,6) int(score_(Name)) = 0 print ("You rolled ", Die1," and ", Die2, " and a total score of :", Die1 + Die2) if Die1 == Die2: score_(Name) = 0 print("You scored a double! :'( ") print("Try again") AnotherGo = "N" else: score_(Name) = score_(Name) + Die1 + Die2 print("Your score is", score_(Name)) print("Try again??") AnotherGo = input() Name1 = input("Please enter your name to start the game") Game(Name1) Name2 = input("Please enter your name to start player 2's game") Game(Name2)
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