SyntaxError: EOL while scanning literal


#1

https://www.codecademy.com/courses/python-ext/projects/rock-paper-scissors

'Yeah, okay, this is Rock Paper Scissors, I think you know how to play. This time you play against RNGesus so do not expect to win haha"

from random import randint
from time import sleep
options = ["R", "P", "S"]
user_lose = "You lost!"
user_win = "You win!"
def decide_winner(user_choice, computer_choice):
  print "Your selection was: %s" % user_choice
  print "Computer selecting..."
  sleep(1)
  print "The computer's choice was: %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 "You have tied with the computer! Play again!"
  elif user_choice_index == 0 and computer_choice_index == 2:
    print user_win
  elif user_choice_index == 1 and computer_choice_index == 0:
    print user_win
  elif user_choice_index == 2 and computer_choice_index == 1:
    print user_win
  elif user_choice_index > 2:
    print "Guns aren't allowed in rock, paper, scissors!"
    return
  else:
    print user_lose

  def play_RPS():
    print "You are playing Rock, Paper, Scissors, Online!"
    user_choice = raw_input("Type R for Rock, P for Paper, and S for Scissors: ")
    sleep(1)
    user_choice = user_choice.upper()
    computer_choice = options[randint(0, len(options)-1)]
    decide_winner(user_choice, computer_choice)
   
  play_RPS()

That is the code. The title is the error I am getting. Any help?


#2

This not a valid docstring and a good place to start looking for the error.

"""
Prompt the user to select either Rock, Paper, or Scissors
Instruct the computer to randomly select either Rock, Paper, or Scissors
Compare the user's choice and the computer's choice
Determine a winner (the user or the computer)
Inform the user who the winner is
"""

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.