Skip to content

Instantly share code, notes, and snippets.

@drewverlee
drewverlee / sudoku.py
Created October 2, 2012 15:32 — forked from jtratner/sudoku.py
Sudoku Solver/Checker - Udacity CS258
def get_subgrids(three_rows):
""" splits given set of three rows into subgrids"""
return zip(*[(row[0:3], row[3:6], row[6:]) for row in three_rows])
def check_sudoku(sudoku):
try:
def check_row(row):
""" checks that the row contains 1 and only 1 element from 1 to 9 and
that the total count == 9"""
counts = [0 for x in range(10)]
for i in range(9):