Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Project One Objectives: incorporate decision-making structures into our code implementing iteration apply nested structures Write a program that plays rock, paper, scissors. This

In Python

Project One

Objectives:

incorporate decision-making structures into our code

implementing iteration

apply nested structures

Write a program that plays rock, paper, scissors. This is an interactive game between two players. The sample run provided below represents the user interaction and the output displayed.

Important Notes:

Your code will use decision-making, nested structures.

Both upper- and lower-case letters should be considered.

Four cases for player 1: R, P, S and never forget the default case. Within each of the first three cases, there are four cases for player two.

Incorporate an iteration method that allows the user to play again, as many times as they like.

Your code must demonstrate at least 1 method from the String class

Sample output:

Test case 1: [NOT A TIE]

Lets play Rock, Paper, Scissors.

Player 1, Enter your choice: r

Player 2, Enter your choice: p

Rock v. Paper

Player 2 wins

again? y

Player 1, Enter your choice: P

Player 2, Enter your choice: S

Paper v. Scissors

Player 2 wins

again? Y

Player 1, Enter your choice: R

Player 2, Enter your choice: s

Rock v. Scissors

Player 1 wins

again? N

Nice game!

Test case 2: [TIE]

Lets play Rock, Paper, Scissors.

Player 1, Enter your choice: R

Player 2, Enter your choice: R

Rock v. Rock

It's a TIE

again? y

Player 1, Enter your choice: p

Player 2, Enter your choice: p

Paper v. Paper

It's a TIE

again? n

Nice game!

Test case 3: [INVALID CHOICE]

Lets play Rock, Paper, Scissors.

Player 1, Enter your choice: p

Player 2, Enter your choice: w

Paper v. [ERROR: w not a valid move.]

again? y

Player 1, Enter your choice: m

[ERROR: m not a valid move.]

again? n

Nice game!

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago