CIS 1250 Python Program5 – Play a game Turn in Requirements: 5 pts. Name your project LastnameP5, such as GarnerP5. Program Requirements: 1. 5 pts. Add comments as appropriate. Be sure that your...

1 answer below »
The attached file contains the instructions and also an example of what the program should look like when it is ran.


CIS 1250 Python Program5 – Play a game Turn in Requirements: 5 pts. Name your project LastnameP5, such as GarnerP5. Program Requirements: 1. 5 pts. Add comments as appropriate. Be sure that your program output is neatly presented to the user. 2. Write a program that does the following: a. Initialize an empty list which you will use to store the results of each game. b. Start a game of rock paper scissors with to user. i. The user will play against the computer. A scissor can cut paper, a rock can knock a scissor, and paper can wrap a rock. ii. Open a do-while loop as a play loop. That way, the player can play the game until the user or the computer has won twice. iii. Ask the user to select his/her choice (rock, paper, scissors) iv. After the user has entered his/her choice, the program use a random number generator for its selection. v. Your program will evaluate who won or if there was a tie. vi. The program reports what the computer chose, the user’s choice, who won that round, and game tally. The game tally shows number of rounds, wins/losses for the player and number of ties. vii. Store that information in your game results list. viii. Ask the player if the user wants to play again. c. When the player is done, write a for loop that displays the game results list. d. When done display a goodbye message. 3. The game should look something like this: Hints: You may need to use an if/elif/else block that will look something like: If elif elif elif else Remember to indent the blocks of code that come after and are associated with your while, if, elif and else statements. To generate random numbers use the random library. Example: import random doanother = 'y' while doanother == 'y': someValue = random.randrange(3) print someValue doanother = raw_input ('Again y/n: ').strip().lower()[0] Example of using Random: >>> import random >>> random.randrange(3) 0 >>> random.randrange(3) 1 >>> random.randrange(3) 2 >>> choices=['rock','paper','scisors'] >>> compchoice = choices[random.randrange(3)] >>> compchoice 'scisors' >>>
Answered Same DayOct 10, 2021

Answer To: CIS 1250 Python Program5 – Play a game Turn in Requirements: 5 pts. Name your project LastnameP5,...

Neha answered on Oct 12 2021
136 Votes
#random library is used to generate a random number for the computer
import random
t = ["rock", "p
aper", "scissors"]
computer = t[random.randrange(3)]
print("Welcome to super RPS 3000, the best rock paper scissor game in the world.")
ans = 'Y'
#if computer wins then this number will be incremented by 1
comp = 0
#if user wins then this number will be incremented by 1
user = 0
while ans == 'Y':
player = input(" Please select 'Rock', 'Paper' or 'Scissors'?").lower()
#If the input from user and computer are same then the game will tie
if player == computer:
print("Tie!")
# if the player selects rock and computer gives paper then player will loose the game else computer will loose the game
elif player == "rock":
if computer == "Paper":
print("You lost! -", computer, "covers", player)
print("You selected:",player, "Computer selected:", computer )
comp = comp+1
print("You...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here