-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhoneText.py
More file actions
35 lines (30 loc) · 1.08 KB
/
Copy pathPhoneText.py
File metadata and controls
35 lines (30 loc) · 1.08 KB
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
def PhoneMesage():
let_and_num = {'1' : '.,?!:;1',
'2' : 'абвг2',
'3' : 'дежз3',
'4' : 'ийкл4',
'5' : 'мноп5',
'6' : 'рсту6',
'7' : 'фхцч7',
'8' : 'шщъы8',
'9' : 'ьэюя9',
'0' : ' 0 0 '}
number_text = input('Введите последовательность: ').split()
letters = []
for num in number_text:
symbol = num[0]
pos = len(num)
count = 1
for i in num:
if i == symbol and count == pos:
if symbol == '1':
letters.append(let_and_num[symbol][count % 7 - 1])
else:
letters.append(let_and_num[symbol][count % 5 - 1])
elif i == symbol:
count += 1
continue
else:
print('Вы вводите не правильное значение.')
return None
print(''.join(letters))