display LCD Digits
def present(s, digits): | |
masks = ('02356789', '045689', '01234789', '2345689', '0268', '013456789', '0235689') | |
result = [] | |
h = lambda x: ' '.join(' ' + ('-' if d in masks[x] else ' ') * s + ' '\ | |
for d in digits) | |
v = lambda x: ' '.join(('|' if d in masks[x] else ' ') + ' ' * s +\ | |
('|' if d in masks[x+1] else ' ') for d in digits) | |
result.append(h(0)) | |
result += [v(1)] * s | |
result.append(h(3)) | |
result += [v(4)] * s | |
result.append(h(6)) | |
print('\n'.join(result)) | |
present(3, "0123456789") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
result: