Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
set and sorted solution in Clear category for Seven Segment by oldjaponec
s=['a','b','c','d','e','f','g','A','B','C','D','E','F','G']
seg=['abcdef','bc','abdeg','abcdg','bcfg','acdfg','acdefg','abc','abcdefg','abcdfg']
seg+=[x.upper() for x in seg]; seg=sorted(seg)
def seven_segment(l, br):
a,b=''.join(sorted([x for x in l if x.isupper()])),''.join(sorted([x for x in l if x.islower()]))
g=sorted(list(set(seg)-set([x for x in seg for i in sorted(list(set(s)-set(br)-set(l))) if i in x])))
return len([x for x in g if set(a)<=set(x)])*len([x for x in g if set(b)<=set(x)]) if len(l)!=0 else 100
if __name__ == '__main__':
assert seven_segment([],["A","B","C","D","E","F","G","a","b","c","d","e","f","g"]) == 100, '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"?')
Sept. 23, 2019
Comments: