Python Rock Paper Scissors Game Code


# needed imports
import random
# The choices are R P and S

print("play infinitely")
choices = ["rock", "paper", "scissors"]
#This is the plauer score
player_score = 0
#this is the computers score
computer_score = 0
# This is a while ture
while True:
    #If payer choice os rock paper or scisscers and lower
    player_choice = input("Choose rock, paper or scissors: ").lower()
    # If choices are like 123 it will ignore and say try again
    if player_choice not in choices:
        #print Try agian
        print("Invalid choice. Try again.")
        # contine for the computer
        continue
        # the computer will pick a random choice 
    computer_choice = random.choice(choices)
    # this tells u what he chose
    print(f"Computer chose {computer_choice}")
    # If player chose the same as computer
    if player_choice == computer_choice:
        # It's a tie
        print("It's a tie!")
        # players choices 
    elif (player_choice == "rock" and computer_choice == "scissors") or (player_choice == "paper" and computer_choice == "rock") or (player_choice == "scissors" and computer_choice == "paper"):
        #win statement
        print("You win!")
        #This will add up on the score board 
        player_score += 1
        # or will add to the computers point 
    else:
        # saying i lost
        print("You lose!")
        # adding to the computers score 
        computer_score += 1
        # will print The payer and computer score on the scoreboard 
    print(f"Player score: {player_score}, Computer score: {computer_score}")