Question
1. Write a Python program to score the paper-rock-scissor game; user vs. computer. The user types in either ( P or p ), ( R
1. Write a Python program to score the paper-rock-scissor game; user vs. computer.
The user types in either (P or p), (R or r), or (S or s).
Computer randomly generates either (P or p), (R or r), or (S or s).
The program then announces the winner as well as the basis for determining the winner:
Paper covers rock,
Rock smashes scissors,
Scissors cut paper,
or Tie!.
***Computer generates only integer values. Do NOT use a list.
Define the following functions (value returning functions):
collectStringInput(): Accepts no arguments, collect a string value from the user, and returns the collected string value: (P or p), (R or r), or (S or s).
generateIntegerValue(): Accepts no arguments, randomly generates an integer number, and returns the generated integer number.
convertIntegerToRPS(): Accepts the integer number generated by generateIntegerValue() as an argument and returns a string value: (P or p), (R or r), or (S or s).
evaluateWinning(): Accepts the value returned by collectStringInput() as an argument and the value returned by convertIntegerToRPS() and returns a string value (announces the winner).
2. Test and verify your program and it's output.
***Be sure to allow the user to use lowercase as well as uppercase letters.
***Be sure to allow the computer to generate lowercase as well as uppercase letters.
OUTPUT:
- The bold text is the user's input.
*************************************************************************************
Enter [R]ock, [P]aper, or [S]cissor Player: p Computer's selection: s Scissor cuts paper. Computer WINS!
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