In [ ]:
 
In [ ]:
 
In [ ]:
import random# helpsmake an action random

user_score = 0#the score at the begining of the game for you
computer_score = 0#the score at the begining of the game for the computer

while True:

    user_action = input("Pick a choice (rock, paper, or scissors): ")#what you could choose
    possible_actions = ["rock", "paper", "scissors"]#your/the computers possible options
    computer_action = random.choice(possible_actions)#the computer 
    print(f"\nYou chose {user_action}, computer chose {computer_action}.\n")#shows what you and the computer shows
    print(f"\nYour score {user_score}, computer score {computer_score}.\n")#shows the score for the previous round
    if user_action == computer_action:#if what you chose is the same as what the computer chose then-
        print(f"Both players selected {user_action}. It's a tie!")#it tells you that the result of the match is a tie
    elif user_action == "rock":#for if you chose rock
        if computer_action == "scissors":#for if the computer chose scissors
            print("Rock beats scissors! You win")#it tells you the winner of the match
            user_score = user_score + 1#it adds 1 point to the winner
        else:#if you chose another option while the computher chose scissors
            print("Paper beats rock! You lose.")#it tells you the winner of the match
            computer_score = computer_score + 1#it adds 1 point to the winner
    elif user_action == "paper":#for if you chose paper
        if computer_action == "rock":#for if the computer chose rock
            print("Paper beats rock! You win")#it tells you the winner of the match
            user_score = user_score + 1#it adds 1 point to the winner
        else:#if you chose anything else while the computer chose rock
            print("Scissors beats paper! You lose.")#it tells you the winner of the match
            computer_score = computer_score + 1#it adds 1 point to the winner
    elif user_action == "scissors":#for if you chose scissors
        if computer_action == "paper":#for if the computer chose paper
            print("Scissors beats paper! You win")#it tells you the winner of the match
            user_score = user_score + 1#it adds 1 point to the winner
        else:# if you chose anything else while the computer chose paper
            print("Rock beats scissors! You lose.")#it tells you the winner of the match
            computer_score = computer_score + 1#it adds 1 point to the winner
    elif user_action != possible_actions:#if you put something that wasn't in the possible options
        print("sorry not an option")#it tells you that what you input wasn't an option
#continues infinitly
In [ ]:
 
In [ ]: