每次运行它都会给我这个语法错误:
File "main.py", line 27
decide_winner (user_choice, computer_choice)
^
IntendationError: unexpected indent
我不知道如何解决这个问题,我已经从事了大约两天的工作,并且我确实有专家为您提供帮助。
from random import randint
options = ['ROCK','PAPER','SCISSORS']
message = {"tie': 'you've tied",
"won': 'you've won!",
"lost': 'you've 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()