Rock, Paper, Scissors syntax

When I run the program in the terminal, this message comes up:
File “RPS.py”, line 16
elif user_choice == options[0] and computer_choice == options[2]:
^
SyntaxError: invalid syntax

I don’t know what the problem is as my code for this part looks similar to the hints. I have copied part of my code below that relates to the issue.

options = ["ROCK", "PAPER", "SCISSORS"]
message = {
  "tie": "Yawn it's a tie!", 
  "won": "Yay you won!", 
  "lost": "Aww you lost!",
}
def decide_winner(user_choice, computer_choice):
  print "You selected: %s" % user_choice
  print "The computer selected: %s" % computer_choice
if user_choice == computer_choice:
  print message["won"]
  elif user_choice == options[0] and computer_choice == options[2]:
    print message["won"]
  elif user_choice == options[1] and computer_choice == options[0]:
    print message["won"]
  elif user_choice == options[2] and computer_choice == options[1]:
    print message["won"]
  else:
    print message["lost"]

The indentation of your if statement is not at the same level as the elif and else.

# You wrote:
def decide_winner(user_choice, computer_choice):
  print "You selected: %s" % user_choice
  print "The computer selected: %s" % computer_choice
if user_choice == computer_choice:
  print message["won"]
  elif user_choice == options[0] and computer_choice == options[2]:
    print message["won"]

# It should be:
def decide_winner(user_choice, computer_choice):
  print "You selected: %s" % user_choice
  print "The computer selected: %s" % computer_choice
  if user_choice == computer_choice:
    print message["won"]
  elif user_choice == options[0] and computer_choice == options[2]:
    print message["won"]

Also, for the condition user_choice == computer_choice,

# Your code:
print message["won"]

# It should be:
print message["tie"]
2 Likes