Back to Freecodecamp

Step 12

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

latest900 B
Original Source

--description--

You can also use dot notation to access an instance attribute.

Outside the Board class, after initializing the gameboard object, use gameboard.board to access the board attribute of your gameboard object and print the result to the screen.

--hints--

You should print gameboard.board.

js
({ test: () => assert(runPython(`_Node(_code).has_call("print(gameboard.board)")`)) })

--seed--

--seed-contents--

py
--fcc-editable-region--
class Board:
    def __init__(self, board):
        self.board = board

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)
--fcc-editable-region--