input: Write a function to create a simple Tic Tac Toe game in Python. The function should define the board, print the board, handle player turns, check for a win, and run the main game loop. The game should allow two players to take turns, display the board after each move, and declare the winner or a tie. The function should return the final state of the board.
  assert main() == ["X", "O", "X", "O", "X", "O", "X", "O", "X"]
  assert main() == ["O", "X", "O", "X", "O", "X", "O", "X", "O"]
  assert main() == ["X", "O", " ", "X", "O", " ", "X", " ", " "]
output: def main():
      board = [" " for _ in range(9)]
      def print_board():
          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 check_win(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 is_full():
          return " " not in board
  
      current_player = "X"
      while True:
          print_board()
          move = int(input(f"Player {current_player}, enter your move (1-9): ")) - 1
          if board[move] == " ":
              board[move] = current_player
              if check_win(current_player):
                  print_board()
                  print(f"Player {current_player} wins!")
                  return board
              if is_full():
                  print_board()
                  print("It's a tie!")
                  return board
              current_player = "O" if current_player == "X" else "X"
          else:
              print("Invalid move, try again.")