Question: import random # Step 0 : Define constants ROCK = 0 PAPER = 1 SCISSORS = 2 hand _ signal _ names = [
import random
# Step : Define constants
ROCK
PAPER
SCISSORS
handsignalnamesROCK"PAPER","SCISSORS" # define the names for each hand signal
# Read seed from input for random number generator
seedvalue intinput
random.seedseedvalue
# Step : Read player names and number of rounds
playername input
playername input
numrounds intinput
# Make sure the number of rounds is valid
while numrounds :
printRounds must be
numrounds intinput
# Output the player names and number of rounds
printfplayername vs playername for numrounds rounds"
# Step : Play the game for the specified number of rounds
playerwins
playerwins
# Loop through each round
for i in rangenumrounds:
# Generate a random hand signal for each player
playersignal random.randint
playersignal random.randint
# If both players make the same signal, it's a tie and we need to generate new signals
while playersignal playersignal:
printTie
playersignal random.randint
playersignal random.randint
# Determine the winner for this round and output a message
if playersignal ROCK and playersignal SCISSORS:
printfplayername wins with rock"
playerwins
elif playersignal SCISSORS and playersignal PAPER:
printfplayername wins with scissors"
playerwins
elif playersignal PAPER and playersignal ROCK:
printfplayername wins with paper"
playerwins
else:
printfplayername wins with handsignalnamesplayersignal
playerwins
# Output the results
printfplayername wins playerwins and playername wins playerwins
IN PYTHON PLEASE
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
