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 »
Dummy Assignment


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 31 days AfterFeb 10, 2021

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

Pratap answered on Mar 14 2021
139 Votes
#Import libraries
from termcolor import colored
from random import randint
#Initial variable declaration
win = 0
lost = 0
tie = 0
win_streak = 0
loose_streak = 0
long_win_streak = []
long_loose_streak = []
#Main menu function of the program
def main_menu():
#Display the menu options
print(
colored("\nMENU:\n", "red", attrs=['bold']),
colored("1. Throw Rock\n", "green", attrs=['bold']),
colored("2. Throw Paper\n", "green", attrs=['bold']),
colored("3. Throw Scissor\n", "green", attrs=['bold']),
colored("4. Quit", "green", attrs=['bold'])
)
try:
#Capture user input from the menu
choice = int(input("Please select a option number from the menu: "))
return choice
except:
#Handle invalid input entry
print(colored("\nInvalid Entry Type!!", "red", attrs=['bold']))
user_query()
#Result display function
def display_result(out, human, computer):
#Use global variables from initial declaration
global win, lost, tie, win_streak, loose_streak,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here