input: Write a function to develop a Tic Tac Toe game in Python. The function should initialize the game, define how the board is displayed, manage player turns, check for victory conditions, and run the main game loop. If the game ends in a tie, the function should print "It's a tie!".
  def tic_tac_toe_game():
      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):
          if icon == "X":
              number = 1
          elif icon == "O":
              number = 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):
          winning_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] == icon and board[b] == icon and board[c] == icon for a, b, c in winning_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()
  
  # Test cases
  tic_tac_toe_game()
  # Expected output:
  # The game should run and handle player moves, display the board, check for victories, and handle ties.
output: def tic_tac_toe_game():
      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):
          if icon == "X":
              number = 1
          elif icon == "O":
              number = 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):
          winning_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] == icon and board[b] == icon and board[c] == icon for a, b, c in winning_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()