Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Scissors-Rock-Paper (SRP) Game When we were children, many of us played this game in which two players simultaneously display a hand in one of three
Scissors-Rock-Paper (SRP) Game When we were children, many of us played this game in which two players simultaneously display a hand in one of three configurations. A flat hand represents paper, a fist represents a rock, and an extended index and middle finger stand for a pair of scissors. The outcome of the game is determined by the following rule: Scissors cut Paper - Scissors wins Paper wraps Rock - Paper wins Rock breaks Scissors Rock wins Write a Python script to simulate SRP game. Save your script as "PA1 Question2.py". Note: You can randomly select an item (a number or a text value) from a list of items in Python using a built-in function called choice from the random module. For example, from random import choice result = choice( [ "Scissors" , "Paper" , "Rock" ] ) Now, the variable will randomly assign one of the three values "Scissors", "Paper" or "Rock" When player (that is user) is supposed to display a hand, you should use the choice function to randomly select an item among [Scissors", "Paper", "Rock"] . To give the player the illusion that he or she is actually displaying the hands, you should use an input statement to "pause" until the user does something, before generating the result. For example, use a statement like: raw input("Player 1: Press ENTER to display a hand") In this case, it is not necessary to store user input in a variable since the script is not using that value later After selecting items for both players, display the winner (Player 1 or Player 2) Hints: You may follow the steps shown in the flowchart given below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started