# Create a random board for the game Boggle from pprint import pprint from random import randrange # Constants for the size of the board NUM_ROWS = 4 NUM_COLS = 4 # Create a new, empty board board = [] # For each row in the board for row in range(NUM_ROWS): # Add a new, empty row to the board board.append([]) # For each column in the board for col in range(NUM_COLS): board[row].append(" ") # Place a random letter at each location in the board for row in range(NUM_ROWS): for col in range(NUM_COLS): # Pick a random letter i = randrange(26) letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i] # Store the letter in the board board[row][col] = letter # Display the board pprint(board)