solution.py
def only_choice(values, unitlist):
    """Finalize all values that are the only choice for a unit.

    Go through all the units, and whenever there is a unit with a value
    that only fits in one box, assign the value to this box.

    Input: Sudoku in dictionary form.
    Output: Resulting Sudoku in dictionary form after filling in only choices.
    """
    # only choice strategy 
    for unit in unitlist:
        for digit in '123456789':
            loc = [box for box in unit if digit in values[box]]
            ###print(loc,values[loc[0]], digit)
            if len(loc) == 1:
                values[loc[0]] = digit
                ###print(loc,values[loc[0]])

    return values
Finalize all values that are the only choice for a unit.

    Go through all the units, and whenever there is a unit with a value
    that only fits in one box, assign the value to this box.

    Input: Sudoku in dictionary form.
    Output: Resulting Sudoku in dictionary form after filling in only choices.
    
Finalize all values that are the only choice for a unit.
Go through all the units, and whenever there is a unit with a value
that only fits in one box, assign the value to this box.

Sudoku in dictionary form.
Output: Resulting Sudoku in dictionary form after filling in only choices.
Finalize all values that are the only choice for a unit . Go through all the units and whenever there is a unit with a value that only fits in one box assign the value to this box . Sudoku in dictionary form . Output : Resulting Sudoku in dictionary form after filling in only choices .
def only_choice(values, unitlist):
    for unit in unitlist:
        for digit in '123456789':
            loc = [box for box in unit if digit in values[box]]
            if len(loc) == 1:
                values[loc[0]] = digit
    return values
def only_choice ( values , unitlist ) : for unit in unitlist : for digit in '123456789' : loc = [ box for box in unit if digit in values [ box ] ] if len ( loc ) == 1 : values [ loc [ 0 ] ] = digit return values
Finalize all values that are the only choice for a unit.
Finalize all values that are the only choice for a unit .
"""Finalize all values that are the only choice for a unit.

    Go through all the units, and whenever there is a unit with a value
    that only fits in one box, assign the value to this box.

    Input: Sudoku in dictionary form.
    Output: Resulting Sudoku in dictionary form after filling in only choices.
    """ # only choice strategy 
 ###print(loc,values[loc[0]], digit)
 ###print(loc,values[loc[0]])

values
unitlist