Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

What is the business opportunity in the creation of virtual humans?

Answered: 1 week ago