Rock Paper Scissors Beginner Python Game
Welcome to Python!



Choosing Rock/Paper/Scissors/

This

if choice == 'R':
    choice = "Rock"
elif choice == 'P':
    choice = "Paper"
elif choice == 'S':
    choice = "Scissors"


can be

choice = [option for option in options if option.startswith(choice)][0]


Since you're grabbing only the first letter, you can make this comparison, instead of checking each option with its own if statement. This also takes advantage of list comprehension. The array is filled for every value that starts with choice. Since only one value will be in this list, you can simply grab the first value in the list [0].


Utilizing in

This

if choice != 'R' or 'P' or 'S':


can be this

if choice not in "RPS":


This simply checks if the choice is within the string, reducing the need to check each individual character separately.


Unnecessary while

This

while cpu_choice == choice:
    print("You chose", choice + "!")
    print("Computer chooses", cpu_choice + "!")
    break


is basically an if statement, since it's a check and only run once

if cpu_choice == choice:
    print("You chose", choice + "!")
    print("Computer chooses", cpu_choice + "!")


We can make it even neater using string formatting

if cpu_choice == choice:
    print(f"You chose {choice}!")
    print(f"Computer chooses {cpu_choice}!")


Also this

while choice != cpu_choice:


should be this

if choice != cpu_choice:




Imports

Imports should go outside of functions, and at the top of the module

import random

def main():
    ... code ...




Better Input Validation

Right now, you check if the input is valid. If it isn't, you print "Invalid choice!". But you don't stop the program. It keeps running with that choice. You can simplify this by using a while loop here, only breaking if the input is valid:

choice = input("Enter your choice: ")
while choice not in "RPS":
    print("Invalid choice!")
    choice = input("Enter your choice: ")




Unused Variables

This

game_active = True


is never used in your program. You should remove this to avoid confusion, as I initially thought this was the flag that determined if the game was to be run again.