input: Write a function to implement an AI Tic-Tac-Toe game using Python. The function should include helper functions for drawing the board, checking for a win, and determining the computer's move. The main function should handle the game loop, alternating between the player's and AI's moves. If the player wins, print "You won!". If the computer wins, print "The computer won!". If the game ends in a draw, print "The game is drawn!".
  assert playGame()==None
  assert playGame()==None
  assert playGame()==None
output: def playGame():
      board = [' ' for _ in range(9)]
  
      def drawBoard():
          print(f"{board[0]}|{board[1]}|{board[2]}")
          print("-+-+-")
          print(f"{board[3]}|{board[4]}|{board[5]}")
          print("-+-+-")
          print(f"{board[6]}|{board[7]}|{board[8]}")
  
      def checkWin(player):
          win_conditions = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
          for condition in win_conditions:
              if board[condition[0]] == board[condition[1]] == board[condition[2]] == player:
                  return True
          return False
  
      def computerMove():
          for i in range(9):
              if board[i] == ' ':
                  board[i] = 'O'
                  if checkWin('O'):
                      return i
                  board[i] = ' '
          for i in range(9):
              if board[i] == ' ':
                  board[i] = 'X'
                  if checkWin('X'):
                      board[i] = 'O'
                      return i
                  board[i] = ' '
          for i in range(9):
              if board[i] == ' ':
                  return i
  
      while True:
          drawBoard()
          move = int(input("Enter your move (0-8): "))
          if board[move] == ' ':
              board[move] = 'X'
              if checkWin('X'):
                  drawBoard()
                  print("You won!")
                  return
              if ' ' not in board:
                  drawBoard()
                  print("The game is drawn!")
                  return
              comp_move = computerMove()
              board[comp_move] = 'O'
              if checkWin('O'):
                  drawBoard()
                  print("The computer won!")
                  return
              if ' ' not in board:
                  drawBoard()
                  print("The game is drawn!")
                  return
          else:
              print("Invalid move, try again.")