Last active
May 19, 2017 09:08
-
-
Save chashmeetsingh/8a7b11e43579e82de7333ec979a3121a to your computer and use it in GitHub Desktop.
only_choice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from utils import * | |
def only_choice(values): | |
for unit in unitlist: | |
for box in unitlist: | |
val = '' | |
for item in box: | |
if len(values[item]) > 1: | |
val += values[item] | |
s = '' | |
for v in val: | |
if val.count(v) == 1: | |
s = v | |
break | |
if s!='' and len(s) == 1: | |
for item in box: | |
if s in values[item] and len(values[item]) > 1: | |
values[item] = s | |
break | |
return values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment