-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOld LCD calculator.py
117 lines (107 loc) · 2.12 KB
/
Old LCD calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
one = [' ',
' |',
' |',
' ',
' |',
' |',
' ']
two = [' -- ',
' |',
' |',
' -- ',
'| ',
'| ',
' -- ']
three = [' -- ',
' |',
' |',
' -- ',
' |',
' |',
' -- ']
four = [' ',
'| |',
'| |',
' -- ',
' |',
' |',
' ']
five = [' -- ',
'| ',
'| ',
' -- ',
' |',
' |',
' -- ']
six = [' -- ',
'| ',
'| ',
' -- ',
'| |',
'| |',
' -- ']
seven = [' -- ',
' |',
' |',
' ',
' |',
' |',
' ']
eight = [' -- ',
'| |',
'| |',
' -- ',
'| |',
'| |',
' -- ']
nine = [' -- ',
'| |',
'| |',
' -- ',
' |',
' |',
' -- ']
zero = [' -- ',
'| |',
'| |',
' ',
'| |',
'| |',
' -- ']
numbers = {1: one,
2: two,
3: three,
4: four,
5: five,
6: six,
7: seven,
8: eight,
9: nine,
0: zero}
input_numbers = [int(s) for s in input()]
# input_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
output = [''] * 9
# Первый столбец
output[0] = 'x'
output[8] = 'x'
for i in range(1, 8):
output[i] = '|'
# Заполняем вывод цифрами
for i in range(len(input_numbers)):
output[0] = output[0] + '----'
count = 1
output[8] = output[8] + '----'
for line in numbers[input_numbers[i]]:
output[count] = output[count] + line
count += 1
if i != len(input_numbers) - 1:
output[0] = output[0] + '-'
output[8] = output[8] + '-'
for i in range(1, 8):
output[i] = output[i] + ' '
# Последний столбец
output[0] = output[0] + 'x'
output[8] = output[8] + 'x'
for i in range(1, 8):
output[i] = output[i] + '|'
print('\n'.join(output))