Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
instruction to Seven Segment mission solution in Clear category for Seven Segment by rus.zzzzz
def seven_segment(lit_seg, broken_seg):
""" the function takes lit and ch lists (description is below),
returns the list of numbers, that the cell can show"""
def possible_digit(lit,ch):
dig_list=[]
sample=[0,0,0,0,0,0,0]
for i in lit:
sample[i]=1
if ch==[]:
if sample in digits:
return [digits.index(sample)]
else:
return []
else:
var=variations(ch)
for i in var:
sam=sample.copy()
for j in range(len(i)):
if i[j]==1:
sam[j]=1
if sam in digits:
dig_list.append(digits.index(sam))
return dig_list
""" the function takes ch (the list of changing segments)
returns the list of variations (2**len(ch) variations)"""
def variations(numbers):
var=[]
for i in range(2**len(numbers)):
temp=bin(i)[2:]
if len(temp)
July 31, 2019
Comments: