Syntax Error: Invalid Syntax at line 18

from random import randit
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 "System selected: %s" % computer_choice
  if user_choice == computer_choice:
    print message["tie"]
    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"]
      print message["lost"]
def play_RPS():
  user_choice = raw_input("Enter Rock, Paper, or Scissors: ")
  computer_choice = options[randit(0,2)]
  decide_winner(user_choice, computer_choice)



from random import randit

randit is not a function within the random module? the name of the function is randint, you have the same typo here:

computer_choice = options[randit(0,2)]

also, your function call on the last line of your script:


this function call is suppose to execute the play_RPS function, so it should be outside/after the function


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