Generating a 3x3 grid in Python
Posted by Samath
Last Updated: January 20, 2024

This is a simple program that generate a 3 by 3 grid using the python programming language. 

board = []

for row in range(3):
  board.append([])
  for column in range(3):
    board[row].append('x')

def print_board(board):
  for row in board:
    print " ".join(row)

print_board(board)

 

Related Content