Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Seven Segment by frbrgeorge
Seg = "abcdef bc abged abgcd fgbc afgcd afgcde abc abcdefg abcdfg"
Seg, seg = [set(s) for s in Seg.upper().split()], [set(s) for s in Seg.split()]
def seven_segment(lit_seg, broken_seg):
L, l = lit_seg & Seg[8], lit_seg & seg[8]
B, b = broken_seg & Seg[8], broken_seg & seg[8]
return len([s for s in Seg if s-B==L-B])*len([s for s in seg if s-b==l-b])
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"?')
Jan. 11, 2019
Comments: