2.4.1.6 LAB: A LED Display

dycanon · updated December 15, 2023
# 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

Comments

Please sign up or log in to contribute to the discussion.