0

I'm a new python developer and was wondering if I could get any help. I'm creating a simple rock paper scissors game and I get the following output on my terminal while entering an INVALID command during the game (line 18: elif userInput == "START") Error that is occuring

The code is found below and I would appriciate help :) I can't tell if I'm just being dumb or if I'm missing some code.

import random

gameChoice = ["ROCK", "PAPER", "SCISSORS"]
score = 0

invalidCommand = "Sorry, please enter a valid command - use the HELP command for more information."

print("WELCOME TO ROCK PAPER SCISSORS, PLEASE USE THE WORD 'HELP' FOR ALL THE COMMANDS")

while True:
    computerChoice = random.choice(gameChoice)
    userInput = input("> ").upper()
    if userInput == "HELP":
        print(f"""START - This will start the game.
SCORE - This will display how many games you have won.
QUIT - This will quit the program""")
    elif userInput == "START":
        ### START THE GAME
        print(f"Please pick between, ROCK(R), PAPER(P), SCISSORS(S)")
        userPlay = input("> ").upper
        if userPlay == computerChoice:
            print(f"You both played {userPlay}. You tied!")
        elif userPlay == "ROCK" or "R":
            if computerChoice == "SCISSORS":
                print("You won! Rock beats scissors!")
                score += 1
            else:
                print("You lose... Paper covers rock")
        elif userPlay == "SCISSORS" or "S":
            if computerChoice == "PAPER":
                print("You won! Scissors cuts paper!")
                score += 1
            else:
                print("You lose... Rock beats scissors")
        elif userPlay == "PAPER" or "P":
            if computerChoice == "ROCK":
                print("You win! Paper covers rock!")
                score += 1
            else:
                print("You lose... Scissors cut paper")
        else:
            print(invalidCommand)
    elif userInput == "SCORE":
        ### DISPLAY THE SCORE
        print(f"You have won %s games" % str(score))
    elif userInput == "QUIT":
        break
    else:
        print(invalidCommand)

Again any help would be greatly appriciated and I hope you are all having/will have a wonderful day.

onitea
  • 1
  • 4
  • Welcome to Stack Overflow. I recommend [this article](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) for some tips on debugging your code. – Code-Apprentice Oct 10 '22 at 20:23

0 Answers0