import random #Allows you to have random numbers, symbols and characters. Also, a built-in module.
def game(score_limit = 3):
user_score = int(0) #Keeps counts of the users score
computer_score = int(0) #Keeps count of the computer score
while user_score != score_limit or computer_score != score_limit: #Shows and lists the scores of the computer and users during the game
user_selection: str = input(str("Enter your choice: rock, paper, or scissors ---> ")).lower() #Lists the selection of what you can shoose in the game
my_list = "rock", "paper", "scissors" #list of what is in the variable
computer_selection = random.choice(my_list) #computer can select random from the list
print("the computer chose", computer_selection) #printed statement of what the computer chooses
if computer_selection == "rock" and user_selection == "rock": #computer and user selection
print ( "Tie!!" ) #computer and user tie because of what they choose
if computer_selection == "paper" and user_selection == "paper": #computer and user selection
print ( "Tie!!" ) #computer and user tie due to their choice
if computer_selection == "scissors" and user_selection == "scissors": #computer and user selection
print ( "Tie!!" ) #computer and user tie due to waht they choose
if computer_selection == "paper" and user_selection == "rock": #computer and user selection
print ( "The computer scores" ) #computer and user choices and computer scores
computer_score = computer_score + 1 #computer scores 1 point
print ( "The computer's score is:", computer_score ) #prints computer score
if computer_selection == "rock" and user_selection == "paper": #computer and user selection
print ( "You scored!!" ) #prints that user score due to selection
user_score = user_score + 1 #users gets 1 point due to selection
print ( "The user score is:", user_score ) #prints user score
if computer_selection == "rock" and user_selection == "scissors": #computer and user selection
print ( "The computer scored" ) #computer scores, printed statement
computer_score = int ( computer_score ) + 1 #computer score another point
print ( "The computer's score is:", computer_score ) #printed statement of computer score
if computer_selection == "scissors" and user_selection == "rock": #computer and user selection
print ( "You scored" ) #user scores
user_score = user_score + 1 #user gets another point due to selection
print ( "The user score is:", user_score ) #printed statement of user score
if computer_selection == "paper" and user_selection == "scissors": #selection of computer and user
print ( "You scored" ) #user scored printed statment
user_score = user_score + 1 #users gets another point
print ( "The user score is:", user_score ) #printed statement of user score
if computer_selection == "scissors" and user_selection == "paper": #computer and user selction
print ( "The computer scored" ) #printed statement that computer scored
computer_score = int ( computer_score ) + 1 #computer got another point
print ( "The computer_score is:", computer_score ) #computer score, printed statement
computer_selection = random.choice ( my_list ) #computer selction is random from the list variable
if user_score == score_limit: #user score and score limit, if equal, user won
print("Congrats You Won!!!") #printed statement that user won
elif computer_score == score_limit: #computer score and score limit, if equal, computer won
print("The Computer Won. Better Luck Next Time!") #printed statement that computer won
goAgain = input("Go Again <enter> again or No ==>") #go again variable loops the programn
if goAgain == "No" or goAgain == "no": #if you do not want to play write no
print("Nice Game! Have a Good Day!!") #printed statement appears if you wrote no.
break #ends program
game()
Enter your choice: rock, paper, or scissors ---> rock the computer chose scissors You scored The user score is: 1 Enter your choice: rock, paper, or scissors ---> paper the computer chose scissors The computer scored The computer_score is: 1 Go Again <enter> again or No ==>rock Enter your choice: rock, paper, or scissors ---> paper the computer chose rock You scored!! The user score is: 2 Enter your choice: rock, paper, or scissors ---> rock the computer chose paper The computer scores The computer's score is: 2 Enter your choice: rock, paper, or scissors ---> paper the computer chose paper Tie!! Enter your choice: rock, paper, or scissors ---> paper the computer chose scissors The computer scored The computer_score is: 3 The Computer Won. Better Luck Next Time! Go Again <enter> again or No ==>No Nice Game! Have a Good Day!!