solver.py
def validate_array(array):
    """
    Validate an array to ensure that it is sudoku-shaped and has no illegal numbers in it (does not check for clashes).

    Returns sudoku order.

    Parameters
    ----------
    array : list of list
        Initial sudoku cells, where 0 is an empty cell.

    Returns
    -------
    int
        Sudoku order.
    """
    n_rows = len(array)

    assert not sqrt(n_rows) % 1, 'Sudoku width is not a square number'
    sudoku_order = int(sqrt(n_rows))
    valid_numbers = set(range(sudoku_order ** 2 + 1))
    for row in array:
        assert len(row) == n_rows, 'Sudoku is not square'
        assert valid_numbers.issuperset(row), 'Row has illegal numbers in it {}'.format(set(row).difference(valid_numbers))

    return sudoku_order

    Validate an array to ensure that it is sudoku-shaped and has no illegal numbers in it (does not check for clashes).

    Returns sudoku order.

    Parameters
    ----------
    array : list of list
        Initial sudoku cells, where 0 is an empty cell.

    Returns
    -------
    int
        Sudoku order.
    
Validate an array to ensure that it is sudoku-shaped and has no illegal numbers in it (does not check for clashes).
Returns sudoku order.

Parameters

array : list of list
Initial sudoku cells, where 0 is an empty cell.

Returns

int
Sudoku order.
Validate an array to ensure that it is sudoku - shaped and has no illegal numbers in it ( does not check for clashes ) . Returns sudoku order . Parameters array : list of list Initial sudoku cells where 0 is an empty cell . Returns int Sudoku order .
def validate_array(array):
    n_rows = len(array)
    assert not sqrt(n_rows) % 1, 'Sudoku width is not a square number'
    sudoku_order = int(sqrt(n_rows))
    valid_numbers = set(range(sudoku_order ** 2 + 1))
    for row in array:
        assert len(row) == n_rows, 'Sudoku is not square'
        assert valid_numbers.issuperset(row), 'Row has illegal numbers in it {}'.format(set(row).difference(valid_numbers))
    return sudoku_order
def validate_array ( array ) : n_rows = len ( array ) assert not sqrt ( n_rows ) % 1 , 'Sudoku width is not a square number' sudoku_order = int ( sqrt ( n_rows ) ) valid_numbers = set ( range ( sudoku_order ** 2 + 1 ) ) for row in array : assert len ( row ) == n_rows , 'Sudoku is not square' assert valid_numbers . issuperset ( row ) , 'Row has illegal numbers in it {}' . format ( set ( row ) . difference ( valid_numbers ) ) return sudoku_order
Validate an array to ensure that it is sudoku-shaped and has no illegal numbers in it (does not check for clashes).
Validate an array to ensure that it is sudoku - shaped and has no illegal numbers in it ( does not check for clashes ) .
"""
    Validate an array to ensure that it is sudoku-shaped and has no illegal numbers in it (does not check for clashes).

    Returns sudoku order.

    Parameters
    ----------
    array : list of list
        Initial sudoku cells, where 0 is an empty cell.

    Returns
    -------
    int
        Sudoku order.
    """
array