Open the context
Choose the project folder and name the files or behavior involved.
Validate a filled nine-by-nine Sudoku without solving missing cells. Check rows, columns and three-by-three blocks, rejecting malformed or non-integer input and returning false for repeated digits.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def sudoku_complete(board):
if type(board) is not list or len(board) != 9:
raise ValueError("nine rows")
if any(type(row) is not list or len(row) != 9 or
any(type(v) is not int or not 1 <= v <= 9 for v in row) for row in board):
raise ValueError("nine integer digits per row")
target = set(range(1,10))
units = board + [list(col) for col in zip(*board)]
units += [[board[y+dy][x+dx] for dy in range(3) for dx in range(3)]
for y in (0,3,6) for x in (0,3,6)]
return all(set(unit) == target for unit in units)The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.