Problem 2 (5 pts) Write a Python program that plays the game Ro-Sham-Bo (a.k.a., Rock, Paper, Scissors) for a player and a computer opponent. The player selects one of the options listed in a console prompt, then the computer randomly selects an option as well. The winner of the game is determined as follows: Rock beats Scissors - Scissors beats Paper - Paper beats Rock The same selection results in a tie. Your program must do the following: Prompt the player to enter a selection in the console. Provide instructions to user on what is a valid input. For example, you can have the integers 1, 2, and 3 represent the selection, or use the words rock, paper, scissors, etc. Check that the user entered valid input. If the entry is invalid, the program needs to inform the user of the invalid input and can end, or re-prompt the user for their entry. Generate a random selection for the computer's choice. You can use a random integer and follow the same rules as was stated to the user. - Display the player and the computer choices to the user. Also, display a label explaining the outcome (e.g., Rock Smashes Scissors!, Scissors Cut Paper!, Paper Covers Rock!). Finally, if the player wins, display "You win!", if the computer wins, display "You lose!", and if the result is a tie display "No winner." NOTE: You are at liberty to design the interface of your program. Figure 2 is an example of an interface for this problem. Bonus points available for adding a more user-friendly experience:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question
Problem 2 (5 pts)
Write a Python program that plays the game Ro-Sham-Bo (a.k.a., Rock, Paper, Scissors) for a player
and a computer opponent. The player selects one of the options listed in a console prompt, then the
computer randomly selects an option as well. The winner of the game is determined as follows:
Rock beats Scissors - Scissors beats Paper - Paper beats Rock
The same selection results in a tie.
Your program must do the following:
Prompt the player to enter a selection in the console. Provide instructions to user on what is
a valid input. For example, you can have the integers 1, 2, and 3 represent the selection, or
use the words rock, paper, scissors, etc.
Check that the user entered valid input. If the entry is invalid, the program needs to inform
the user of the invalid input and can end, or re-prompt the user for their entry.
Generate a random selection for the computer's choice. You can use a random integer and
follow the same rules as was stated to the user.
-
Display the player and the computer choices to the user.
Also, display a label explaining the outcome (e.g., Rock Smashes Scissors!, Scissors Cut
Paper!, Paper Covers Rock!).
Finally, if the player wins, display "You win!", if the computer wins, display "You lose!",
and if the result is a tie display "No winner."
NOTE: You are at liberty to design the interface of your program. Figure 2 is an example of an
interface for this problem.
Bonus points available for adding a more user-friendly experience:
Transcribed Image Text:Problem 2 (5 pts) Write a Python program that plays the game Ro-Sham-Bo (a.k.a., Rock, Paper, Scissors) for a player and a computer opponent. The player selects one of the options listed in a console prompt, then the computer randomly selects an option as well. The winner of the game is determined as follows: Rock beats Scissors - Scissors beats Paper - Paper beats Rock The same selection results in a tie. Your program must do the following: Prompt the player to enter a selection in the console. Provide instructions to user on what is a valid input. For example, you can have the integers 1, 2, and 3 represent the selection, or use the words rock, paper, scissors, etc. Check that the user entered valid input. If the entry is invalid, the program needs to inform the user of the invalid input and can end, or re-prompt the user for their entry. Generate a random selection for the computer's choice. You can use a random integer and follow the same rules as was stated to the user. - Display the player and the computer choices to the user. Also, display a label explaining the outcome (e.g., Rock Smashes Scissors!, Scissors Cut Paper!, Paper Covers Rock!). Finally, if the player wins, display "You win!", if the computer wins, display "You lose!", and if the result is a tie display "No winner." NOTE: You are at liberty to design the interface of your program. Figure 2 is an example of an interface for this problem. Bonus points available for adding a more user-friendly experience:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 1 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning