Tic Tac toe游戏不断获得无效的语法

时间:2016-08-11 15:12:22

标签: python

我试图在python中制作一个tic tac toe游戏,并且在“1”之后,first.upper()上的无效语法不断出现。我甚至移动了代码,它仍然在“1”之后。如何修复代码?

first == input("Would u like to go first? 1 is Yes  2 is No \n")
if first.upper() == "1" 
    place == input("You are X where do u want to place it? \n")

2 个答案:

答案 0 :(得分:3)

在python中,每当你使用" if"声明,你必须跟上':'然后去下一行。 所以它应该是:

if first.upper() == "1":
    place == input("You are X where do u want to place it? \n")

答案 1 :(得分:0)

first = input("Would u like to go first? 1 is Yes  2 is No \n")
if first.upper() == 1: 
    place = input("You are X where do u want to place it? \n")

试试