Last active
May 2, 2022 09:00
-
-
Save olecksamdr/4dbc326d0cbfef02847fee0374d8f724 to your computer and use it in GitHub Desktop.
Шифр Цезаря (caesar cipher) на python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abc = 'абвгґдеєжзиіїйклмнопрстуфхцчшщьюя' | |
msg = input('Введіть повідомлення: ') | |
key = int(input('Введіть зміщення: ')) | |
msg = msg.lower() | |
count = len(abc) | |
for letter in msg: | |
idx = abc.index(letter) | |
new_idx = (idx + key) % count | |
print(abc[new_idx], end='') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment