2.4.1.6 LAB: A LED Display
Python
# Seven Segment Layout:
# In this layout, each number is represented by its corresponding in-situ value in the list.
# For example, ss[0] represents Zero.
# Additionally, the rows for drawing are represented by columns.
# For instance, ss[x][5] corresponds to the last row."
ss=(('###','# #','# #','# #','###'),
(' #',' #',' #',' #',' #'),
('###',' #','###','# ','###'),
('###',' #','###',' #','###'),
('# #','# #','###',' #',' #'),
('###','# ','###',' #','###'),
('###','# ','###','# #','###'),
('###',' #',' #',' #',' #'),
('###','# #','###','# #','###'),
('###','# #','###',' #','###'))
# User inputs the data
user_input = input('please enter any non-negative integer: ')
# Prints a row per cycle:
for row in range(5):
# Prints the row for each iterable.
for i in user_input:
print(ss[int(i)][row], end = ' ')
# break line as the row has been completly printed.
print()
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.