Answers for "howt o make sure its a valid sudoku in python"

0

howt o make sure its a valid sudoku in python

def check(sud):
    zippedsud = zip(*sud)

    boxedsud=[]
    for li,line in enumerate(sud):
        for box in range(3):
            if not li % 3: boxedsud.append([])    # build a new box every 3 lines
            boxedsud[box + li/3*3].extend(line[box*3:box*3+3])

    for li in range(9):
        if [x for x in [set(sud[li]), set(zippedsud[li]), set(boxedsud[li])] if x != set(range(1,10))]:
            return False
    return True
Posted by: Guest on January-28-2021

Code answers related to "howt o make sure its a valid sudoku in python"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language