I've been having troubles with getting a loop for tic tac toe
here is the code
here is the code
board = [1, 2, 3, 4, 5, 6, 7, 8, 9] print("Welcome to Tic-Tac-Toe!") print(" " + str(board[0]) + " | " + str(board[1]) + " | " + str(board[2]) + " ") print("-----------") print(" " + str(board[3]) + " | " + str(board[4]) + " | " + str(board[5]) + " ") print("-----------") print(" " + str(board[6]) + " | " + str(board[7]) + " | " + str(board[8]) + " ") board_location = input("Enter the board location to play for player X: ") board_location = int(board_location) board_index = board_location - 1 board[board_index] = "X" print(" " + str(board[0]) + " | " + str(board[1]) + " | " + str(board[2]) + " ") print("-----------") print(" " + str(board[3]) + " | " + str(board[4]) + " | " + str(board[5]) + " ") print("-----------") print(" " + str(board[6]) + " | " + str(board[7]) + " | " + str(board[8]) + " ") board_location = input("Enter the board location to play for player O: ") board_location = int(board_location) board_index = board_location - 1 board[board_index] = "O" print(" " + str(board[0]) + " | " + str(board[1]) + " | " + str(board[2]) + " ") print("-----------") print(" " + str(board[3]) + " | " + str(board[4]) + " | " + str(board[5]) + " ") print("-----------") print(" " + str(board[6]) + " | " + str(board[7]) + " | " + str(board[8]) + " ")