import random win=0 loss=0 tie=0 round = 1 print("Lets Play Rock Paper Scissors!") turns = int(input("How many times would you like to play? ")) for i in range(1,turns+1): print("Round # ",round) round+=1 print("0 = Rock, 1 = paper, 2 = scissors") playerchoice = int(input("Pick 0, 1, or 2: ")) compchoice = random.randrange(3) print(compchoice) if compchoice ==0 and playerchoice==1: print("You win!") print("Paper Covers Rock") print() win+=1 elif compchoice == 1 and playerchoice == 2: print("You win!") print("Scissors Cuts Paper") print() win+=1 elif compchoice==2 and playerchoice==0: print("You win!") print("Rock Breaks Scissors") print() win+=1 elif compchoice == playerchoice: print("You Tied") print() tie+=1 else: print("You Lost :(") print() loss+=1 print() print() print("You won ",win," games") print("You lost ",loss," games") print("You tied ",tie," games") print() if win > loss: print("You won the match") elif win == loss: print("You tied the match") else: print("You lost the match")
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