Skip to content

Instantly share code, notes, and snippets.

@ftt
ftt / gist:3134480
Created July 18, 2012 05:56
CS258 (sudoku checker)
valid_range = range(0, 10)
def check_list(l):
return type(l) == list and len(l) == 9
def check_values(l):
counts_ok = not any([l.count(e) - 1 for e in l if e != 0])
ranges_ok = (len([e for e in l if e in valid_range]) == len(l))
return counts_ok and ranges_ok