I need help finishing my python rock paper scissors code, where it asks the user "rock, paper, scissors", the user types either option (repeatedly asks until its one of the three), and for a random option from the code to select also rock paper scissors. The end result would be you winning, code winning, or a tie.My code:import randomOPTIONS = ("ROCK", "PAPER", "SCISSOR") def getInput():    """        Function getInput() will receive and validate user input to be        the string ROCK, PAPER, or SCISSOR.  Input must be spelled correctly        and in all capital letters.  Function will return the validated input         @return user input as ROCK, PAPER, OR SCISSOR    """    #need help here def checkWinner(user, computer):    """        Function checkWinner will accept 2 string parameters that must be unique        values of ROCK, PAPER, or SCISSOR.  Functions should return true if the        string in parameter user beats the string in parameter computer in a game        of rock paper, scissor and false otherwise         @param user: contains string ROCK, PAPER or SCISSOR        @param computer: contains string ROCK, PAPER or SCISSOR, but cannot                         be the same as user         @return: True is user beats computer false othewise    """     #need help here     def main():    #Code here is good, no change needed.    print("Welcome to Rock, Paper, and Scissors")    user = getInput()    computer = random.choice(OPTIONS)    print(f"You chose: {user}")    print(f"I chose:   {computer}")    while user == computer:        print("Tie game, play again")        user = getInput()        computer = random.choice(OPTIONS)        print(f"You chose: {user}")        print(f"I chose:   {computer}")    winner = checkWinner(user, computer)    if winner:        print("You Won!")    else:        print("I Won!") main()

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 15E
icon
Related questions
Question

I need help finishing my python rock paper scissors code, where it asks the user "rock, paper, scissors", the user types either option (repeatedly asks until its one of the three), and for a random option from the code to select also rock paper scissors. The end result would be you winning, code winning, or a tie.
My code:

import random
OPTIONS = ("ROCK", "PAPER", "SCISSOR")


def getInput():
    """
        Function getInput() will receive and validate user input to be
        the string ROCK, PAPER, or SCISSOR.  Input must be spelled correctly
        and in all capital letters.  Function will return the validated input

        @return user input as ROCK, PAPER, OR SCISSOR
    """
    #need help here

def checkWinner(user, computer):
    """
        Function checkWinner will accept 2 string parameters that must be unique
        values of ROCK, PAPER, or SCISSOR.  Functions should return true if the
        string in parameter user beats the string in parameter computer in a game
        of rock paper, scissor and false otherwise

        @param user: contains string ROCK, PAPER or SCISSOR
        @param computer: contains string ROCK, PAPER or SCISSOR, but cannot
                         be the same as user

        @return: True is user beats computer false othewise
    """
     #need help here
    


def main():
    #Code here is good, no change needed.
    print("Welcome to Rock, Paper, and Scissors")
    user = getInput()
    computer = random.choice(OPTIONS)
    print(f"You chose: {user}")
    print(f"I chose:   {computer}")
    while user == computer:
        print("Tie game, play again")
        user = getInput()
        computer = random.choice(OPTIONS)
        print(f"You chose: {user}")
        print(f"I chose:   {computer}")
    winner = checkWinner(user, computer)
    if winner:
        print("You Won!")
    else:
        print("I Won!")

main()

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr