subject

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.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, crimhill
When is it appropriate to use an absolute reference
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
image
Computers and Technology, 23.06.2019 10:30, tommyaberman
Would a ps4 wired controller work on an xbox one
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, sparkyjones02
Which best describes the condition under which the unicode output is the same as plain text ?
Answers: 1
You know the right answer?
Create a game of rock paper and scissors in which a player plays either 'Rock', 'Paper' or 'Scissor...

Questions in other subjects: