Design a python program that simulates the game rock, paper, and scissors. You are to keep track of your wins, losses, and ties. You are to allow the users to play over and over again until he or she...

1 answer below »
pfa


Design a python program that simulates the game rock, paper, and scissors.  You are to keep track of your wins, losses, and ties.  You are to allow the users to play over and over again until he or she decides to quit.  After each throw, you will display the results of the throw followed by the current win, loss, tie numbers.  A throw consists of the player picking either Rock, Paper, or Scissors followed by the computer randomly choosing Rock, Paper, or Scissors. Rules of the game: Rock beats Scissors. Paper beats Rock. Scissor beats paper. MENU: 1. Throw Rock 2. Throw Paper 3. Throw Scissors 4. Quit Sample Run: Option 1: == RESULTS == Computer Throws Scissors, you win Wins…………………...:1 Losses………………...: 0 Ties…………………..: 0 Longest Win Streak....: 1 Longest Lose Streak..: 0 Note: After each Throw you will display the results from above
Answered 5 days AfterJun 28, 2021

Answer To: Design a python program that simulates the game rock, paper, and scissors. You are to keep track of...

Atal Behari answered on Jul 04 2021
143 Votes
import random
w = 0
L = 0
t = 0
ws = 0
ls = 0
while True:
print("MENU: \n"
"1. Throw Rock
\n"
"2. Throw Paper \n"
"3. Throw Scissors \n"
"4. Quit \n")
user_action = int(input("Enter your choice: "))
possible_actions = {1: "rock", 2: "paper", 3: "scissors"}
computer_action = random.randint(1, 3)
if user_action == computer_action:
print("computer Throws " + possible_actions[computer_action] + ", It's a tie!")
t += 1
print("Wins................: ", str(w)
+ "\nLosses...........: ", str(L)
+ "\nTies..............:", str(t)
+ "\nLongest Win streak: ", str(ws)
+ "\nLongest Lose streak: ", str(ls))
ls = 0
ws = 0
elif user_action == 1:
if computer_action == 3:
print("Computer Throws " + possible_actions[computer_action] + ", You win")
w += 1
ws += 1
print("Wins................: ", str(w)
+ "\nLosses...........: ", str(L)
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here