def is consistent (self) -> bool: Check if the board as a whole is consistent according to sudoku rules. :return: True if the board is consistent and False otherwise. # TODO: check if the values in a board are consistent according to the sudoko rules. # Below I'm giving you a pseudocode for what the solution would look like! for each row, column and block init a set named 'used_symbols' to hold the used symbol in each row, column c block. Note that a set is initialized by 'set()' for each tile in the group (row, column or block) if the tile value is in CHOICES check if the tile value is in 'used_symbols' if so we fail (return False) otherwise add the tile value to the set of 'used_symbols' if we reach this point without failure, then rerun True (the board is consistent)

icon
Related questions
Question

i need a code for this method in python there is a pseudocode and everything is explained I didnt include any other methods of my code i just need solution for this method, no output or explanantion is needed.

method----------------

 

def is consistent (self) -> bool:
Check if the board as a whole is consistent
according to sudoku rules.
:return: True if the board is consistent and False otherwise.
# TODO: check if the values in a board are consistent according to the sudoko
rules.
# Below I'm giving you a pseudocode for what the solution would look like!
for each row, column and block
init a set named 'used_symbols' to hold the used symbol in each row, column or
block. Note that a set is
initialized by 'set()'
for each tile in the group (row, column or block)
if the tile value is in CHOICES
check if the tile value is in 'used_symbols'
if so we fail (return false)
otherwise add the tile value to the set of 'used_symbols'
if we reach this point without failure, then rerun True (the board is consistent)
Transcribed Image Text:def is consistent (self) -> bool: Check if the board as a whole is consistent according to sudoku rules. :return: True if the board is consistent and False otherwise. # TODO: check if the values in a board are consistent according to the sudoko rules. # Below I'm giving you a pseudocode for what the solution would look like! for each row, column and block init a set named 'used_symbols' to hold the used symbol in each row, column or block. Note that a set is initialized by 'set()' for each tile in the group (row, column or block) if the tile value is in CHOICES check if the tile value is in 'used_symbols' if so we fail (return false) otherwise add the tile value to the set of 'used_symbols' if we reach this point without failure, then rerun True (the board is consistent)
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer