SudokuFunctions.py
def only_choice(values):
    """Apply the only choice strategy to a Sudoku puzzle

    The only choice strategy says that if only one box in a unit allows a certain
    digit, then that box must be assigned that digit.

    Parameters
    ----------
    values(dict)
        a dictionary of the form {'box_name': '123456789', ...}

    Returns
    -------
    dict
        The values dictionary with all single-valued boxes assigned

    Notes
    -----
    You should be able to complete this function by copying your code from the classroom
    """
    
    # We check each unit, in order to see the values for each of them
    for unit in unitlist:
        # We check each digit
        for digit in '123456789':
            dboxes = [box for box in unit if digit in values[box]]
            if len(dboxes) == 1 and len(values[dboxes[0]])>1:
                values[dboxes[0]] = digit
    return values
    
    raise NotImplementedError
Apply the only choice strategy to a Sudoku puzzle

    The only choice strategy says that if only one box in a unit allows a certain
    digit, then that box must be assigned that digit.

    Parameters
    ----------
    values(dict)
        a dictionary of the form {'box_name': '123456789', ...}

    Returns
    -------
    dict
        The values dictionary with all single-valued boxes assigned

    Notes
    -----
    You should be able to complete this function by copying your code from the classroom
    
Apply the only choice strategy to a Sudoku puzzle
The only choice strategy says that if only one box in a unit allows a certain
digit, then that box must be assigned that digit.

Parameters



Returns

dict
The values dictionary with all single-valued boxes assigned

Notes

You should be able to complete this function by copying your code from the classroom
Apply the only choice strategy to a Sudoku puzzle The only choice strategy says that if only one box in a unit allows a certain digit then that box must be assigned that digit . Parameters Returns dict The values dictionary with all single - valued boxes assigned Notes You should be able to complete this function by copying your code from the classroom
def only_choice(values):
    for unit in unitlist:
        for digit in '123456789':
            dboxes = [box for box in unit if digit in values[box]]
            if len(dboxes) == 1 and len(values[dboxes[0]])>1:
                values[dboxes[0]] = digit
    return values
    raise NotImplementedError
def only_choice ( values ) : for unit in unitlist : for digit in '123456789' : dboxes = [ box for box in unit if digit in values [ box ] ] if len ( dboxes ) == 1 and len ( values [ dboxes [ 0 ] ] ) > 1 : values [ dboxes [ 0 ] ] = digit return values raise NotImplementedError
Apply the only choice strategy to a Sudoku puzzle
The only choice strategy says that if only one box in a unit allows a certain
digit, then that box must be assigned that digit.
Apply the only choice strategy to a Sudoku puzzle The only choice strategy says that if only one box in a unit allows a certain digit then that box must be assigned that digit .
"""Apply the only choice strategy to a Sudoku puzzle

    The only choice strategy says that if only one box in a unit allows a certain
    digit, then that box must be assigned that digit.

    Parameters
    ----------
    values(dict)
        a dictionary of the form {'box_name': '123456789', ...}

    Returns
    -------
    dict
        The values dictionary with all single-valued boxes assigned

    Notes
    -----
    You should be able to complete this function by copying your code from the classroom
    """ # We check each unit, in order to see the values for each of them # We check each digit
values