Computers and Technology

Create a game of rock paper and scissors in which a player plays either 'Rock', 'Paper' or 'Scissors' and a computer tries to beat the player based on the player's previous moves.

Follow the steps given below:

1. Create a list: ['0', '1', '2'] and store it in the variable called valid_entries, i. e,

valid_entries = ['0', '1', '2'].

2. Create an infinite while loop. Inside the loop, create a variable called user_input to

store the input taken by the player.

3. Use the input() function to take input from a player. Inside the input() function,

write the Enter 0 for ROCK, 1 for PAPER and 2 for SCISSORS: statement to show it

as a message to a player.

4. Write another while loop to check whether the input provided by a player exists in

the valid_entries list or not.

5. If the input provided by a player does not exist in the valid_entries list, then print

Invalid Input! message. In the next line, rewrite the user_input = input("Enter 0 for

ROCK, 1 for PAPER and 2 for SCISSORS: ") statement.

6. Now, outside the inner while loop, convert the user_input value to an integer value

using the int() function.

7. Call the update_scores() function with the user_input as an input to update the

scores of the computer and the player.

8. Call the update_counts() function with the user_input as an input to update the

counts of the inputs provided by the player.

9. Write an if statement to check if the score is 10 for any of the player. If the

comp_score == 10, then print the Computer Won! message and break the loop.

Else if the player_score == 10, then print the You won! message and break the

loop.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:30, ayoismeisjuam
What are compression artifacts? 1) visible defects in the picture caused by the nature of the compression algorithm. 2) numbers that tell a web server how much to compress a picture for faster transmission. 3) invisible defects in the picture preserved by lossless compression. 4) numbers that tell a photo editing program how much to compress a picture for faster transmission.
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, ahmedeldyame
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
image
Computers and Technology, 23.06.2019 16:00, natasniebow
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, DSUDLER5555
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
Do you know the correct answer?
Create a game of rock paper and scissors in which a player plays either 'Rock', 'Paper' or 'Scissor...

Questions in other subjects:

Konu
Mathematics, 03.10.2021 17:20
Konu
Health, 03.10.2021 17:20
Konu
Mathematics, 03.10.2021 17:20