Python rock paper scissors project


#1

i cant get my rock paper scissors project to work. the error message just say “unexpected indent”

This is my code

"""ds
ds"""
from random import randint
options = ['ROCK','PAPER','SCISSORS']
message = {'tie': 'you tied',
          'won': 'you win',
          'lost': 'you lost'
          }
def decide_winner(user_choice, computer_choice):
  print 'you chose %s' % user_choice
  print 'computer chose %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']
  else:
  	print message['lost']
def play_RPS():
  user_choice = raw_input('Enter ROCK PAPER or SCISSORS')
  user_choice = user_choice.upper()
  computer_choice = options[randint(0,2)]
	decide_winner(user_choice, computer_choice)			
play_RPS()

#2

It should indicate a line number where the error is found. Can you post the complete error message?

def play_RPS():
  user_choice = raw_input('Enter ROCK PAPER or SCISSORS')
  user_choice = user_choice.upper()
  computer_choice = options[randint(0,2)]
	decide_winner(user_choice, computer_choice)

Could be a case a mixed tabs and spaces. Change all tabs to spaces.


#3

oh thanks its working now


#4

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