Answered step by step
Verified Expert Solution
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 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 "askforint" validation function! Handle scenario if enters an integer other than or Print userfriendly 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 D list at the top of your code that stores all outcome combinations. Replace your 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 for Rock, for Paper, for Scissors: abc Please only enter an integer. Try again. Enter for Rock, for Paper, for Scissors: Invalid int. Please enter or Try again. Enter for Rock, for Paper, for Scissors: You chose paper The computer chose scissors You lost. Human: Computer: Enter for Rock, for Paper, for Scissors: You chose scissors The computer chose paper Congrats, you won! Human: Computer: Enter for Rock, for Paper, for Scissors: You chose rock The computer chose scissors Congrats, you won! Human: Computer: Goodbye!
ITP 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 "askforint" validation function!
Handle scenario if enters an integer other than or Print userfriendly 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 D list at the top of your code that stores all outcome combinations.
Replace your 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 for Rock, for Paper, for Scissors: abc Please only enter an integer. Try again.
Enter for Rock, for Paper, for Scissors: Invalid int. Please enter or Try again.
Enter for Rock, for Paper, for Scissors: You chose paper
The computer chose scissors
You lost.
Human: Computer:
Enter for Rock, for Paper, for Scissors: You chose scissors
The computer chose paper
Congrats, you won!
Human: Computer:
Enter for Rock, for Paper, for Scissors: You chose
rock
The computer chose scissors
Congrats, you won!
Human: Computer:
Goodbye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started