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:
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:
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 1 steps

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education