$ python
File "", line 16
print "Computer selecting..."
IndentationError: unindent does not match any outer i
ndentation level

I can't track down the indentation problem, any keener eyes able to help?

Rock, Paper, Scissors
from random import randint 
from sleep import time

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

lose = "You lost"

win = "You win"

def decide_winner(user_choice, computer_choice):
	print "user choice %s" % user_choice
  print "Computer selecting..."
  print "computer choice %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 "A tie"  
    elif user_choice_index == 0 and computer_choice_index == 2:
    	print win
    elif user_choice_index == 1 and computer_choice_index == 0:
        print win
    elif user_choice_index == 2 and computer_choice_index == 1:
        print win
    elif user_choice_index > 2:
        print "invalid choice"
        print lose
def play_RPS():
  print "Rock Paper Scissors"
  user_choice = raw_input("Select R for Rock, P for Paper, or S for Scissors:")
  user_choice = user_choice.upper()
  computer_choice = options[randint(0, len(options)-1)]
decide_winner(user_choice, computer_choice)


Since all the code is inside the function block, it should all line up with the same left margin. The if statement is good, but the lines above it are rather jagged.


Thanks for that I corrected it and still get this error, any other observations?

File "", line 22
if user_choice_index == computer_choice_index:
IndentationError: unindent does not match any outer i
ndentation level


You're mixing tabs and spaces


Holy smokes! Thanks team, I was indeed mixing tabs and spaces, lesson learned!


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