r1=" " # nothing on
r2=" ### " # horizontal segment is on
r3="# " # left side is on
r4=" #" # right side is on
r5="# #" # both left and right are on
rows=[[r2,r5,r5,r5,r1,r5,r5,r5,r2], # defining zero row-by-row
[r1,r4,r4,r4,r1,r4,r4,r4,r1], # defining one row-by-row
...etc...
_#_ abc _0_
#_# def 1_2
_#_ ghi _3_
#_# jkl 4_5
_#_ mno _6_
abbbc
deeef
deeef
deeef
ghhhi
jkkkl
jkkkl
jkkkl
mnnno
My way is by looking at what part of the line we are writing (1-8) and write the line according to the block set for that digit.