Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The second image is a continuation of the one above* Examine the code and answer these questions- 1. What is the name of the list?
The second image is a continuation of the one above*
Examine the code and answer these questions-
1. What is the name of the list?
2. What is stored in the list?
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?
8. How does the procedure incorporate sequencing, selection, and iteration.
9. How does the procedure contribute to the program's intended purpose?
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
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