Question: Question 6 (9 points) In the game rock-paper-scissors two players each choose simultaneously between the shapes rock, paper, and scissors. The winner is determined by
Question 6 (9 points) In the game rock-paper-scissors two players each choose simultaneously between the shapes rock, paper, and scissors. The winner is determined by the following rules: rock beats scissors scissors beats paper paper beats rock if both players choose the same shape then the result is a tie (there is no winner) In this question you must use the strings 'R, 'P' and 'S' to represent the hands rock, paper, and scissors, respectively. You can generate a random shape as follows: import random shape = random.choice('RPS') 'P', or 'S' # shape will be one of 'R', Write a Python program that repeatedly plays rounds of rock-paper- scissors between two simulated players until a total of 20 rounds have not ended in a tie. For each round played, the two simulated players should pick a random shape using the function random.choice. After a total of 20 rounds have not ended in a tie your program should print: the number of rounds won by player 1 the number of rounds won by player 2 the number of rounds that resulted in a tie and then exit. You can submit your work by filling in the textbox below, or by uploading your .py file using the Add File button. Question 6 (9 points) In the game rock-paper-scissors two players each choose simultaneously between the shapes rock, paper, and scissors. The winner is determined by the following rules: rock beats scissors scissors beats paper paper beats rock if both players choose the same shape then the result is a tie (there is no winner) In this question you must use the strings 'R, 'P' and 'S' to represent the hands rock, paper, and scissors, respectively. You can generate a random shape as follows: import random shape = random.choice('RPS') 'P', or 'S' # shape will be one of 'R', Write a Python program that repeatedly plays rounds of rock-paper- scissors between two simulated players until a total of 20 rounds have not ended in a tie. For each round played, the two simulated players should pick a random shape using the function random.choice. After a total of 20 rounds have not ended in a tie your program should print: the number of rounds won by player 1 the number of rounds won by player 2 the number of rounds that resulted in a tie and then exit. You can submit your work by filling in the textbox below, or by uploading your .py file using the Add File button
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
