Tic Tac Toe (Text Version)

#Tic Tac Toe Checker

board = [[1,2,3], [4,5,6], [7,8,9]]

def print_board():
    for i in board:
        print(i)

player = 'X'
run = True
while run:
    print('Player', player, 'Turn')
    print_board()
    place = int(input('Choose a tile'))
    for row in board:
        for tile in row:
            if tile == place:
                if player == 'X':
                    row[row.index(tile)] = 'X'
                else:
                    row[row.index(tile)] = 'O'

    for row in board:
        for tile in row:
            if tile == player:
                continue
            else:
                break
        else:
            print('Win')
            print_board()
            run = False

    for column in range(3):
        for row in board:
            if row[column] == player:
                continue
            else:
                break
        else:
            print('Win')
            print_board()
            run = False

    for tile in range(1, 10, 4):
        print(tile)

    if player == 'X':
        player = 'O'
    else:
        player = 'X'