Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Seven Segment by caitlan
s={1:{'b','c'}, 2:{'a','b','g','e','d'}, 3:{'a','b','g','c','d'},
4:{'f','g','b','c'},5:{'a','f','g','c','d'}, 6:{'a','c','d','e','f','g'},
7:{'a','b','c'}, 8:{'a','b','c','d','e','f','g'},
9:{'a','b','c','d','f','g'}, 0:{'a','b','c','d','e','f'}
}
s8={'a','b','c','d','e','f','g'}
S8={'A','B','C','D','E','F','G'}
def seven_segment(lit_seg, broken_seg):
L1=set(map(lambda x:x.lower(),set(lit_seg)&S8))
L2=set(lit_seg)&s8
B1=set(map(lambda x:x.lower(),set(broken_seg)&S8))
B2=set(broken_seg)&s8
Count1=0
Count2=0
for i in range(10):
if L1.issubset(set(s[i])) and (set(s[i])-L1).issubset(B1):
Count1+=1
if L2.issubset(set(s[i])) and (set(s[i])-L2).issubset(B2):
Count2+=1
return Count1*Count2
if __name__ == '__main__':
assert seven_segment({'B', 'C', 'b', 'c'}, {'A'}) == 2, '11, 71'
assert seven_segment({'B', 'C', 'a', 'f', 'g', 'c', 'd'}, {'A', 'G', 'D', 'e'}) == 6, '15, 16, 35, 36, 75, 76'
assert seven_segment({'B', 'C', 'a', 'f', 'g', 'c', 'd'}, {'A', 'G', 'D', 'F', 'b', 'e'}) == 20, '15...98'
print('"Run" is good. How is "Check"?')
April 24, 2019