Stuck in Rock, Paper, Scissors

Hi there!

I stuck in Rock, Paper, Scissors project. I did everything the same as in the tutorial video does. However, I cannot get the output. It keeps saying that there are the errors on line 29 and 32. I think about an indent, but I cannot figure out where I did wrong. Following is my code.

“”“Welcome to

from random import randint
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 “Computer 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: ").upper()
computer_choice = options[randint(0, 2)]




1 Like

1 Like

Python will only react to bad indentation if it cannot read (match everything to syntax rules) the code at all. Your program started, so that is not the case. Reading the error message will also tell you that indentation is not mentioned, that isn’t what is being complained about.

You get multiple lines told to you because it tells you the call stack (multiple calls nested inside one another, functions calling functions)

You also get told that a certain type that you are using does not support a particular operation. This, together with the location it happened at (it tells you that the most recent call is listed last) is something that you can compare to what you meant to happen.

You may want to test the operation you’re trying to in isolation from the rest of the code.

1 Like