I wan to write a program that takes a number and prints out a graphical representation of it to the console. For example, with the input 123
I should expect to get:
Here's how I tried to implement it, starting with implementing one
and two
.
def g (n):
n = list(str(n))
dic = { '1': """1
1
1
1
1
1
1
""",
'2': """2222
2
2
2
2 2
2
2
2
22222"""
}
for i in n:
print(dic[i])
However I get this for the input '121':
>>>
>>> g(121)
1
1
1
1
1
1
1
2222
2
2
2
2 2
2
2
2
22222
1
1
1
1
1
1
1
UPDATE: I corrected the syntax error. Thanks. I still get a somewhat weird result.