-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcezar.py
More file actions
26 lines (25 loc) · 847 Bytes
/
cezar.py
File metadata and controls
26 lines (25 loc) · 847 Bytes
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
alfavit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZЯ' \
'АБВГДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯАБВГДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯ' \
'1234567890*/'
step = int(1)
while True:
message = input("Enter a message to code: ").upper()
resolt = ''
for i in message:
mesto = alfavit.find(i)
new_mesto = mesto + step
if i in alfavit:
resolt += alfavit[new_mesto]
else:
resolt += i
print(resolt.lower())
message1 = input("Enter a message to uncode: ").upper()
resolt = ''
for i in message1:
mesto = alfavit.find(i)
new_mesto = mesto - step
if i in alfavit:
resolt += alfavit[new_mesto]
else:
resolt += i
print(resolt.lower())