Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that will play Rock, Paper, Scissors (RPS) with the values (list) passed from the player. For each player's choice, the function will

image text in transcribed

Write a function that will play Rock, Paper, Scissors (RPS) with the values (list) passed from the player. For each player's choice, the function will pick a random choice (rock, paper, scissors) and then compare it with the player's value to determine if the player won, lost, or drew. The result should be stored in one dictionary that contains all information for any player who calls the function. The list is rps=['rock', 'paper', 'scissors'] In the main, create two lists representing 10 choices for each player. The choices are random. Then create two threads, each with the player's name as the thread name, and pass the player's list to the RPS function. Finally, print the content of the dictionary. Sample output: \{'Yasmeen': \{'win': 5, 'lose': 2, 'draw': 3\}, 'Eman': { 'win': 4, 'lose': 4, 'draw': 2} You must use the random module and the random.choice(LISTNAME) to pick a random element from a list. It would be best if you used a global dictionary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

8. Design office space to facilitate interaction between employees.

Answered: 1 week ago