# 2. Python Program to Display a 3×3 Tic-Tac-Toe Board
### Program
```python
# Tic-Tac-Toe Board
# State Representation
board = [" " for _ in range(9)]
# Display the board
def display_board():
print()
print(board[0], "|", board[1], "|", board[2])
print("--+---+--")
print(board[3], "|", board[4], "|", board[5])
print("--+---+--")
print(board[6], "|", board[7], "|", board[8])
print()
# Display initial board
print("Initial Tic-Tac-Toe Board:")
display_board()
# Get position from user
position = int(input("Enter a position (1-9) to place X: "))
# Place X on the selected position
if 1 <= position <= 9:
board[position - 1] = "X"
# Display updated board
print("Updated Tic-Tac-Toe Board:")
display_board()
```
### Sample Output
```text
Initial Tic-Tac-Toe Board:
| |
--+---+--
| |
--+---+--
| |
Enter a position (1-9) to place X: 5
Updated Tic-Tac-Toe Board:
| |
--+---+--
| X |
--+---+--
| |
```
### State Representation
The board is represented using a **list of 9 elements**:
```python
board = [" " for _ in range(9)]
```
The positions are mapped as:
```text
1 | 2 | 3
--+---+--
4 | 5 | 6
--+---+--
7 | 8 | 9
```
For example, if the user enters **5**, the state becomes:
```python
[" ", " ", " ", " ", "X", " ", " ", " ", " "]
```
This program **does not implement the complete game logic**; it only demonstrates the board state and placing an `X`.