我正在从这个页面上学习python课程。 https://inventwithpython.com/chapter10.html 我已经创建了井字塔克托键入所有代码从上述网站自己
有时代码可以正常工作。有时候我犯了这个错误,游戏就崩溃了
Traceback (most recent call last):
File "E:\Python\tictac.py", line 139, in <module>
makeMove(theBoard, computerLetter, move)
File "E:\Python\tictac.py", line 40, in makeMove
board[move] = letter
TypeError: list indices must be integers, not NoneType
这是我输入的游戏代码
^{pr2}$
您应该转换:
到
^{pr2}$问题是,由于缩进,你不能计算所有的自由位置。相反,你只检查第一个候选人的职位,如果它是免费的,当它不是你什么都不返回。在
相关问题 更多 >
编程相关推荐