ROCK PAPER SCISSORS indentation error


#1


File "RPS.py", line 23
print TIE_MESSAGE
^
IndentationError: unindent does not match any outer ind
entation level


"""
this program is used to celect ether
rock paper or scissors 
"""
from random import randint
from time import sleep

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

LOSS_MESSAGE = "You Lost!"
WINNING_MESSAGE = "You Won!"
TIE_MESSAGE = "Its a tie!"
def decide_winner(user_choice, computer_choice):
	print "you selected: %s" 
	user_choice
	print "computer selecting" 
	sleep(1)
	computer_choice
	print "computer selected: %s" 
	user_choice_index = options.index(user_choice)
	computer_choice_index = options.index(computer_choice)
	if user_choice_index == computer_choice_index:
    print TIE_MESSAGE
	elif user_choice_index == 0 and computer_choice_index == 2:
    print WINNING_MESSAGE
	elif user_choice_index == 1 and computer_choice_index == 0:
    print WINNING_MESSAGE
	elif user_choice_index == 3 and computer_choice_index == 2:
    print WINNING_MESSAGE
	elif user_choice_index > 2:
    print"That input is invalid"
    return
	else:
  print LOSS_MESSAGE
def play_RPS() :
	print "Rock, Paper, or Scissors?"
	user_choice = raw_input("Select R for Rock, P for Paper, or S for Scissors: ")
	user_choice = user_choice.upper()
	sleep(1)
	computer_choice = options[randint(0,len(options)-1)]
	decide_winner(user_choice, computer_choice)
  
play_RPS()


#2

You do realize that this is where parsing stops, and net necessarily the actual error? But then if it is where the error is, it must be indentation.


#3

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