Here's the rule. You and your opponent, at the same time to make specific gestures, must be the following gestures: stone, scissors, cloth. Winners from
In the following rule, the rule itself is a paradox.
(a) cloth-covered stones.
(b) Rock-breaking scissors,
(c) Scissors cut rags. In your computer version, the user enters her/his options, the computer is looking for a random option, and then you
Program to decide a winner or a tie. Note: The best algorithm is to use the IF statement as little as possible
Copy Code code as follows:
#coding: Utf-8
Import Random
Guess_list = ["Stone", "scissors", "cloth"]
Guize = [["Cloth", "stone"],["stone", "Scissors"],["scissors", "cloth"]]
While True:
Computer = Random.choice (guess_list)
People = input (' Please enter: stone, scissors, cloth \ n '). Strip ()
If people not in Guess_list:
People = input (' re-Please enter: stone, scissors, cloth \ n '). Strip ()
Continue
if computer = = People:
Print ("Tie, play again!") ")
elif [Computer,people] in guize:
Print ("Computer wins!") ")
Else
Print ("People win!") ")
Break