Share ko lang yung ginawa ko a while ago para sa assignment ng kaibigan ko. This code will print positive integers as a 3-line glyph:
Disclaimer: this is just how I did it, not sure kung may mas ez pa. Kung meron kayong better code or other ideas, share niyo rin :>
Code:
# Sample output for 5674:
# _ _ _
# |_ |_ | |_|
# _| |_| | |
s = input('Enter Number: ')
STAMP = ' _ |_||_|'
NUM = ['4', '13467', '38', '36', '167', '56', '5', '3467', '', '6']
# data
buf = []
for nc in s:
buf.append(''.join([STAMP[x] if (str(x) not in NUM[int(nc)]) else ' ' for x in range(0, 9)]))
# print per line
for x in range(0, 9, 3):
print(' '.join([c[x:x+3] for c in buf]))
Disclaimer: this is just how I did it, not sure kung may mas ez pa. Kung meron kayong better code or other ideas, share niyo rin :>
Spoiler contents are visible only to Established Members.