input: 
  def tic_tac_toe():
      """
      Implements a basic Tic Tac Toe game in Python where two players can take turns to play.
      The game board is a 3x3 grid represented by a list of 9 cells. The players are 'X' and 'O'.
      The game checks for a win condition after each move and announces the winner or if it's a tie.
      """
      board = [" " for i in range(9)]
  
      def print_board():
          row1 = "| {} | {} | {} |".format(board[0], board[1], board[2])
          row2 = "| {} | {} | {} |".format(board[3], board[4], board[5])
          row3 = "| {} | {} | {} |".format(board[6], board[7], board[8])
          print()
          print(row1)
          print(row2)
          print(row3)
          print()
  
      def player_turn(icon):
          number = 1 if icon == "X" else 2
          print("Your turn player {}".format(number))
          choice = int(input("Enter your move (1-9): ").strip())
          if board[choice - 1] == " ":
              board[choice - 1] = icon
          else:
              print("That space is taken!")
  
      def is_victory(icon):
          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)
          ]
          return any(board[a] == board[b] == board[c] == icon for a, b, c in win_conditions)
  
      def main():
          print("Welcome to Tic Tac Toe!")
          print_board()
          while True:
              player_turn("X")
              print_board()
              if is_victory("X"):
                  print("X Wins! Congratulations!")
                  break
              elif not " " in board:
                  print("It's a tie!")
                  break
  
              player_turn("O")
              print_board()
              if is_victory("O"):
                  print("O Wins! Congratulations!")
                  break
              elif not " " in board:
                  print("It's a tie!")
                  break
  
      main()
  
  # Example:
  # >>> tic_tac_toe()
  # Welcome to Tic Tac Toe!
  # |   |   |   |
  # |   |   |   |
  # |   |   |   |
  # Your turn player 1
  # Enter your move (1-9): 5
  # |   |   |   |
  # |   | X |   |
  # |   |   |   |
  # Your turn player 2
  # Enter your move (1-9): 1
  # | O |   |   |
  # |   | X |   |
  # |   |   |   |
  # ... continues until a win or tie condition is met.
  
output:     
      def is_draw():
          return all(cell != " " for cell in board)
  
      def main():
          print("Welcome to Tic Tac Toe!")
          print_board()
          while True:
              player_turn("X")
              print_board()
              if is_victory("X"):
                  print("X Wins! Congratulations!")
                  break
              elif is_draw():
                  print("It's a tie!")
                  break
  
              player_turn("O")
              print_board()
              if is_victory("O"):
                  print("O Wins! Congratulations!")
                  break
              elif is_draw():
                  print("It's a tie!")
                  break
  
      main()
  