#Papier Stein Schere import random i = 0 R = "Rock" P = "Paper" S = "Scissor" while i <= 5: i += 1 Userchoice = int(input("Choose your Weapon\n 1:Rock\n 2:Paper\n 3:Scissor\n= " )) randomindex = random.randrange(4) if Userchoice == 1 and randomindex == 1: print ("Computer took:",R) print ("No one wins") elif Userchoice == 1 and randomindex == 2: print ("Computer took:",P) print ("You lost") else: Userchoice == 1 and randomindex == 3 print ("Computer took", S) print ("You won") if Userchoice == 2 and randomindex == 1: print ("Computer took:",R) print ("You won") elif Userchoice == 2 and randomindex == 2: print ("Computer took:",P) print ("No one wins") else: Userchoice == 2 and randomindex == 3 print ("Computer took", S) print ("You lost") if Userchoice == 3 and randomindex == 1: print ("Computer took:",R) print ("You lost") elif Userchoice == 3 and randomindex == 2: print ("Computer took:",P) print ("You won") else: Userchoice == 3 and randomindex == 3 print ("Computer took", S) print ("No one wins")
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