Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ITP - 1 5 0 - Assignment - Rock, Paper, Scissors II - Instructions Recall the previous Rock, Paper, Scissors assignment. Create a new Python

ITP-150- Assignment - Rock, Paper, Scissors II - Instructions
Recall the previous Rock, Paper, Scissors assignment. Create a new Python file and copy your RPS code.
Update your new file to include the following changes:
= Handle the exception if user enters "abc" or a float. Print a message and ask user to enter the choice again. Optional: You can do this by creating an "ask_for_int" validation function!
= Handle scenario if enters an integer other than 1,2, or 3. Print user-friendly error message and ask user to enter the choice again.
= Do not quit when the user wins. Instead, keep a counter of how many times the human won and how many times computer won. Keep playing until someone wins twice.
= After each round, print the outcome and print the counters.
Change your logic for determining the outcome.
Add a 2D list at the top of your code that stores all outcome combinations.
Replace your 9-scenario if statement with a lookup of the outcome from the list
(You may also do some other kind of logic, must be a list or dictionary lookup)
= Print a "goodbye" message at the end of the program.
Requirements - Sample Output Messages:
Enter 1 for Rock, 2 for Paper, 3 for Scissors: abc Please only enter an integer. Try again.
Enter 1 for Rock, 2 for Paper, 3 for Scissors: 60 Invalid int. Please enter 1,2, or 3. Try again.
Enter 1 for Rock, 2 for Paper, 3 for Scissors: 2 You chose paper
The computer chose scissors
You lost.
Human: 0 Computer: 1
Enter 1 for Rock, 2 for Paper, 3 for Scissors: 3 You chose scissors
The computer chose paper
Congrats, you won!
Human: 1 Computer: 1
Enter 1 for Rock, 2 for Paper, 3 for Scissors: 1 You chose
ro.ck
The computer chose scissors
Congrats, you won!
Human: 2 Computer: 1
Goodbye!
image text in transcribed

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

Will you actually use Model 7.3 to motivate yourself?

Answered: 1 week ago

Question

Which of the motivational theories do you prefer? Why?

Answered: 1 week ago