<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
Traceback (most recent call last):
File “/Volumes/ELEMENTS/tic tac toe.py”, line 29, in
after_every_move(board)
File “/Volumes/ELEMENTS/tic tac toe.py”, line 2, in after_every_move
print(board[0][0],board[0][1],board[0][2],board[0][3],board[0][4])
TypeError: ‘NoneType’ object is not subscriptable
<What do you expect to happen instead?>
def after_every_move(board):
print(board[0][0],board[0][1],board[0][2],board[0][3],board[0][4])
print(board[1][0],board[1][1],board[1][2],board[1][3],board[1][4])
print(board[2][0],board[2][1],board[2][2],board[2][3],board[2][4])
print(board[3][0],board[3][1],board[3][2],board[3][3],board[3][4])
print(board[4][0],board[4][1],board[4][2],board[4][3],board[4][4])
def move(board):
if board[0][0] and board[0][2] == "O" and board[0][4] == " ":
board[0][4] = "X"
elif board[0][0] and board[0][4] == "O" and board[0][2] == " ":
board[0][2] = "X"
elif board[0][2] and board[0][4] == "O" and board[0][0] == " ":
board[0][0] = "X"
print(“tic tac toe. you will be noughts (O). you will also go first”)
board = [[“O”,"|"," “,”|",“O” ],
["-","+","-","+","-"],
[" “,”|"," “,”|"," “],
[”-","+","-","+","-"],
[" “,”|"," “,”|"," "]]
after_every_move(board)
board = move(board)
after_every_move(board)
<do not remove the three backticks above>