Can anyone look my code over and see if the can spot the bug? Edit : I have indentations correct... they diddnt paste over for some reason


from random import randint
from time import sleep

options = ['R', 'P', 'S']
loss_message = "You lost, try again."
win_message =  "Congratulations, you won!"

def decide_winner(user_choice, computer_choice):
	print "You've chosen %s" % (user_choice)
	print "Computer selecting..."
	print "Your opponent's choice is %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 "It's a draw!"
	elif (user_choice_index) == 0 (computer_choice_index)== 2:
		print win_message
	elif (user_choice_index) == 1 (computer_choice_index)== 0:
		print win_message
	elif (user_choice_index) == 2 (computer_choice_index)== 1:
		print win_message
	elif (user_choice_index) > 2:
		print "The rules aren't that complicated, just play along and choose one of the choices given. It's not that hard to grasp..."
		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()
	computer_choice = options[randint(0,len(options)-1)]
	decide_winner(user_choice, computer_choice)



elif (user_choice_index) == 0 (computer_choice_index)== 2:

you do two comparisons, but without and operator. And why use so many parentheses? This is python


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