Untitled
unknown
python
2 months ago
1.0 kB
2
Indexable
Never
# ЛОГИКА ЗАШИФРОВКИ def encrypt(word, step): encrypted = '' for char in word: encrypted += encrypt_symbol(char, step) return encrypted def encrypt_symbol(symbol, step): if symbol.isalpha(): i = rus.index(symbol) + step return rus[i % 32] return symbol # ЛОГИКА РАСШИФРОВКИ def decrypt(word, step): decrypted = '' for char in word: decrypted += decrypt_symbol(char, step) return decrypted.lower() def decrypt_symbol(symbol, step): if symbol.isalpha(): return rus[rus.index(symbol) - step] return symbol def main(): encrypted = "Блажен, кто верует, тепло ему на свете!" step = 1 print(encrypt(encrypted, step)) rus = 'абвгдежзийклмнопрстуфхцчшщъыьэюя' eng = '' if __name__ == '__main__': # абвгдежзийклмнопрстуфхцчшщъыьэюя, 32 main()