Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 我的Python 2.7代码中有一个语法错误。我需要帮助_Python 2.7 - Fatal编程技术网

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()