Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete and correct this phyton code so that it performs the task outlined. Then copy and paste the completed code from Python and paste
Please complete and correct this phyton code so that it performs the task outlined. Then copy and paste the completed code from Python and paste it in your reply as one (easy to understand) document on Chegg.
IT 280 - Lab \#2: Guessing Game (Rock, Paper, Scissors, Lizard, Spock) Instructions To Submit This Program In IDLE, choose File -> NewFile. Type your program in the window that pops up, saving it as you work. The file name should be your Last Name, followed by Lab 2.2.py in a Python program. Test the program by running it (F5 or Run Run Module). Program Inputs: Ask the user for their choice (Rock, Paper, Scissors, Lizard, Spock) - (This can be done through a menu choice or in any other way). The program will randomly choose one of the five possibilities. (Generate random numbers in Python). The program will generate the winner and an appropriate statement based on the following: Rock crushes Lizard Rock destroys Scissors Paper disproves Spock Paper covers Rock Scissors cuts Paper Scissors decapitate Lizard Lizard eats Paper Lizard Poisons Spock Spock smashes Scissors Spock vaporizes Rock The user will then be asked if they want to play again, and the process repeats until they choose to stop playing. Please correct and complete this phyton code so that it performs the task outlined above. import random def get_choice(): \# This function gets the user's choice of move. choice = inputi,"Enter your choice (Rock, Paper, Scissors, Lizard, Spock):") choice = choice.lower') if choice in ["rock", "paper", "scissors", "lizard", "spock"]: return choice else: print("Invalid choice. Try again. ") return get_choice() def get_computer_choice(): \# This function gets the computer's choice of move. choices = ["rock", "paper", "scissors", "lizard", "spock"] return random.choice(choices) def get_winner(player_choice, computer_choice): \# This function determines the winner of the game. if player_choice == computer_choice: return "tie" elif player_choice =e "rock": if computer_choice == "scissors" or computer_choice == "lizard": return "player" else: return "computer" if player_choice == "paper". if computer_choice == "rock" or computer_choice == "spock": return "player" else: return "computer" elif player_choice == "scissors": if computer_choice == " paper" or computer_choice == " lizard" : return "player" elseStep 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