Learn Classes and Objects by Building a Sudoku Solver - Step 15

Tell us what’s happening:

def find_empty_cell(self):
for row,contents in enumerate(self.board):
print(row,contents)

I am stuck in this stage, although the code seems correct.

Your code so far

class Board:
  def __init__(self, board):
    self.board = board

# User Editable Region

    def find_empty_cell(self):
      for row,contents in enumerate(self.board):
        print(row,contents)

# User 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)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0

Challenge Information:

Learn Classes and Objects by Building a Sudoku Solver - Step 15

Welcome to our community!

The instructions do not require print(row, contents). What do we use in a case of the lack of concrete code within the body of a ‘for’ loop?

2 Likes

I put pass but still not working…

Found it…it was the identation of the whole function. Thank you for your reply! Have a nice day!

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.