Rock, paper scissors, User input not in list

project
python

#1

I, am currently rtying to do the Rock , paper Scissors project.

every thing seems to be working well,
unless I enter something other than R, P, or S

"elif user_choice_index > 2:" this is supposed to catch it however

I get an error saying the user guess is not inside the list.

am i missing something?

"""
This is a game of rock papper scissors
"""
from random import randint
from time import sleep

options = ["R", "P", "S"]

USER_LOST = "I have defeated you with my superior and infinite knowlage"
USER_WINS = "Hmmm... You won... this must be what you call luck..."

def decide_winner(user_choice, computer_choice):
  print
  print "You have chossen %s" % user_choice
  print
  print "Computer selecting....."
  sleep(1)
  print
  print "I have chossen %s" % computer_choice
  user_choice_index = options.index(user_choice)
  computer_choice_index = options.index(computer_choice)
  if user_choice_index == computer_choice_index:
      print
      print "Hmmm it appears we have a tie"
  elif user_choice_index == 0 and computer_choice_index == 2:
      print
      print USER_WINS
  elif user_choice_index == 1 and computer_choice_index == 0:
      print
      print USER_WINS
  elif user_choice_index == 2 and computer_choice_index == 1:
      print
      print USER_WINS
  elif user_choice_index > 2:
      print "Please choose on of the three options"
      return
  else:
      print
      print USER_LOST
     
def play_RPS():
  print "Rock, Paper, Scissors"
  user_choice = raw_input("Please select either, \n'R' for Rock\n'P' for Paper\n'S' for Scissor: ")
  sleep(1)
  user_choice = user_choice.upper()
  computer_choice = options[randint(0,len(options) - 1)]
                          
  decide_winner(user_choice, computer_choice)
                          
play_RPS()

Thanks


#2

why should elif user_choice_index > 2 catch the problem? The whole item isn't even in the list, so it will never get a index

I would simply check if it is in the list, and it would be the first thing i do:

  user_choice = user_choice.upper()
  if user_choice not in options:
      print "Please choose on of the three options"
      return 2

#3