Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Second image is a continuation of the one above it* Examine the code and answer the questions- 3. How is it populated with values? Remember

image text in transcribedimage text in transcribed

Second image is a continuation of the one above it*

Examine the code and answer the questions-

3. How is it populated with values? Remember it must help to fulfill the purpose of the program.

4. What is the name of the procedure?

6. What parameter or parameters are used in the procedure?

7. What does the procedure do?

from random import randint #creating a list of play options t = ["rock", "paper", "scissors"] #initalze the score for computer and player c_score = 0 p_score = 0 tie = #start a loop to play this game 10 times for i in range (10): #assign a random play to the computer computer = t[randint(0,2)] while True : player = input("Enter rock, paper, or scissors: ") if player in ["rock", "paper", "scissors"]: | break else: print("Not A Valid Play. Retry") print(f" The player choose {player} The computer chooses {computer} ") #score keeping and play results if player = computer: tie += 1 print(" TIE ") elif player = "rock": if computer == "paper": C_score + 1 print(" COMPUTER WON, PLAYER LOST ") else: p_score += 1 print(" PLAYER WON, COMPUTER LOST ") elif player == "paper": if computer == "scissors": C_score += 1 print(" COMPUTER WON, PLAYER LOST ") else: p_score += 1 print(" PLAYER WON, COMPUTER LOST ") elif player = "scissors": if computer == "rock": C_score + 1 print(" COMPUTER WON, PLAYER LOST ") else: p_score += 1 print(" PLAYER WON, COMPUTER LOST ") #now printing the result print(f"player wins : {p_score}") print(f"computer wins : {c_score}") print("ties: {tie}")

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

List the various data sources in GIS?

Answered: 1 week ago