1. Fundamentals of Python
Activity 1.01: Building a Sudoku Solver
Solution
- First, we define the
Solver
class to store its input puzzle in itscells
attribute, as follows:from copy import deepcopy class Solver: def __init__(self, input_path): # Read in the input file and initialize the puzzle with open(input_path, 'r') as f: lines = f.readlines() self.cells = [list(map(int, line.split(','))) \ for line in lines]
- The helper method that prints out the puzzle in a nice format can loop through the individual cells in the puzzle while inserting the separating characters
'-'
and...