In [7]:
#I am importing the randint command from the random library
from random import randint 
#I am importing the the clear_output command from the Ipython.display library
from IPython.display import clear_output

#creates a list with three options thats named options
options = ["rock", "paper", "scissors"]
#creates a variable called yourScore that has a value of 0
yourScore = 0
#creates a variable called computorScore that has a value of 0
computorScore = 0


#creates a function called leave
def leave():
    #creates a variable called exitQuestion which value is decided by the user
    exitQuestion = input("would you like to try again? Y,y or N,n ==> ")
    #the if statement says that if the exitQuestion has a value of Y or y then this set code is run
    if exitQuestion == "Y" or exitQuestion == "y":
        #brings you back to the main function
        main()
    #the elif says that if the value of exitQuestion has a value of N or n then this set code is run
    elif exitQuestion == "N" or exitQuestion == "n":
        #clears the screen of all outputs
        clear_output()
        #prints a formated text that talks about your and the computors total points
        print("you have a total of {} wins and the computor has a total of {} wins".format(yourScore, computorScore))
        #prints a text that tells you to have a good day
        print("have a good day")
    #if the if or elif statement can't run then the else statement is run
    else:
        #brings you back to the leave funtion
        leave()
        
        
#creates a function called main
def main():
    #makes the yourScore variable usable in all functions and not just a local variable 
    global yourScore
    #makes the computorScore variable usable in all functions and not just a local variable
    global computorScore
    
    #makes a variable called computorChoice which gets its value by selecting a random option from the options variable
    computorChoice = options[randint(0,2)]
    #tells you that it will give you all options
    print("Here are all possibles options")
    #tells you your first option is rock
    print("First option is Rock")
    #tells you your second option is paper
    print("Second option is Paper")
    #telss you the final option is scissors
    print("Third and final option Scissors")
    #creates a variable called variable called finding Choice which is a number that gets subtracted by 1 so it is usable when finding the choice in the options variable 
    findingChoice = int(input("please select one of the three options ==> ")) -1
    #uses the number from findingChoice to gets its choice in the options variable
    yourChoice = options[findingChoice]
    
    #clears the screen of all outputs
    clear_output()
    #prints a formatted text that tells you what you and the computor choose
    print("you choose {} while the computor choose {}".format(yourChoice, computorChoice))
    
    #this you that if computorChoice and yourChoice is equal the this code is run
    if computorChoice == yourChoice:
        #tells you that you have tied 
        print("you have tied")
        #runs the leave command 
        leave()
        
    #if the if the previous opttions can't run then this funtion checks yourChoice is equal to rock then this funtion
    elif yourChoice == "rock":
        #checks to see if rock is equal to scissors
        if computorChoice == "scissors":
            #adds 1 to your score
            yourScore += 1
            #tells you win and your total score
            print("You win and now have a total of {} wins".format(yourScore))
            #runs leave function
            leave()
        #if the if statement can't run then this function is run
        else:
            #adds 1 to the computor score
            computorScore += 1
            #tells you the computor wins and its total score
            print("The computor wins and a total of {} wins".format(computorScore))
            #runs the leave funtion
            leave()
        
    #if the previous elifs and if statements can't be run then this statement check to see if yourchoice is paper so it can run
    elif yourChoice == "paper": 
        #checks to see if the computor choose rock if it is then this function is run
        if computorChoice == "rock":
            #adds 1 to your score 
            yourScore += 1
            #tells you that you win and your total score
            print("You win and now have a total of {} wins".format(yourScore))
            #runs the leave funtion
            leave()
        # if the previous statement can't be run then this funtion is run
        else:
            #adds 1 to the computors score
            computorScore += 1 
            #tells the computor won and its total score
            print("The computor wins and now has a total of {} wins".format(computorScore))
            #runs the leave function
            leave()
    
    #if the previous elifs and if statement can't be run then this checks to see if yourChoice is equal to scissors
    elif yourChoice == "scissors":
        #checks to see if the computorChoice is equal to paper if so then this funtion is run
        if computorChoice == "paper":
            #adds 1 to yourScore
            yourScore += 1 
            #tells you that you won and tells you your totalScore
            print("You Win and now have a total of {} wins".format(yourScore))
            #runs the leave funtion
            leave()
        #if the previous else statement can't be run then this function is run
        else:
            #adds 1 to the computorScore 
            computorScore += 1
            #tells you the computor won and its totalScore
            print("The computor wins and now has a total of {} wins".format(computorScore))
            #runs the leave funtion
            leave()
    
#runs the main funtion
main()
you have a total of 2 wins and the computor has a total of 0 wins
have a good day