Python 2.7 我的Python 2.7代码中有一个语法错误。我需要帮助
每当我运行它时,它都会给我以下语法错误:Python 2.7 我的Python 2.7代码中有一个语法错误。我需要帮助,python-2.7,Python 2.7,每当我运行它时,它都会给我以下语法错误: File "main.py", line 27 decide_winner (user_choice, computer_choice) ^ IntendationError: unexpected indent 我不知道如何解决这个问题,我已经做了大约两天了,我真的是一个专家在这方面的帮助 from random import randint options = ['ROCK','PAPER','SCISSORS'] message = {"tie
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()