Back to Freecodecamp

Step 14

curriculum/challenges/english/blocks/learn-classes-and-objects-by-building-a-sudoku-solver/6606a3ccb1eea93a23c066bf.md

latest1.1 KB
Original Source

--description--

Now you'll work on a method that finds the empty cells in the sudoku board.

Within the Board class, create an empty method named find_empty_cell and give it a self parameter.

--hints--

You should define a method named find_empty_cell inside your Board class.

js
({ test: () => assert(runPython(`_Node(_code).find_class("Board").has_function("find_empty_cell")`)) })

Your find_empty_cell method should have a parameter self.

js
({ test: () => assert(runPython(`_Node(_code).find_class("Board").find_function("find_empty_cell").has_args("self")`)) })

--seed--

--seed-contents--

py
--fcc-editable-region--
class Board:
    def __init__(self, board):
        self.board = board
    
--fcc-editable-region--
puzzle = [
  [0, 0, 2, 0, 0, 8, 0, 0, 0],
  [0, 0, 0, 0, 0, 3, 7, 6, 2],
  [4, 3, 0, 0, 0, 0, 8, 0, 0],
  [0, 5, 0, 0, 3, 0, 0, 9, 0],
  [0, 4, 0, 0, 0, 0, 0, 2, 6],
  [0, 0, 0, 4, 6, 7, 0, 0, 0],
  [0, 8, 6, 7, 0, 4, 0, 0, 0],
  [0, 0, 0, 5, 1, 9, 0, 0, 8],
  [1, 7, 0, 0, 0, 6, 0, 0, 5]
]

gameboard = Board(puzzle)