# # Create a 4 x 4 game board for Boggle populated with random letters. # import pprint import random # # Create a new board where every location is empty. # # Initialize board to an empty list board = [] # For the desired number of rows for row in range(4): # Add a new empty row to the board board.append([]) # For the desired number of columns for col in range(4): # Add a column to the most recent row board[row].append(" ") pprint.pprint(board) # # Visit every location and store a random letter at that location. # for row in range(4): for col in range(4): board[row][col] = random.choice("AAAAABCDEEEEEFGHIIIIIJKLLLLLMNOOOOOPQRRRRSSSSSTTTTTUUUVWXYZ") pprint.pprint(board)