Skip to content

Instantly share code, notes, and snippets.

@chashmeetsingh
Last active May 19, 2017 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chashmeetsingh/8a7b11e43579e82de7333ec979a3121a to your computer and use it in GitHub Desktop.
Save chashmeetsingh/8a7b11e43579e82de7333ec979a3121a to your computer and use it in GitHub Desktop.
only_choice
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