/
kpiotrovskiy
/
basicencryptor
Обзор
Документация
Войти
/
kpiotrovskiy
/
basicencryptor
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
master
algorithms/caesar.py
19 строк
567 B
kpiotrovskiy
Первая версия программы
26 май 2025, 04:15
26 май 2025, 04:15
83b3ced
Код
Авторство
О чём код?
from typing import Iterable def encrypt(alphabet: Iterable, text: str, shift: int) -> str: cypher = '' for s in text: if s.lower() not in alphabet: cypher += s.lower() continue cypher += alphabet[alphabet.index(s.lower()) + shift] return cypher def decrypt(alphabet: Iterable, text: str, shift: int) -> str: cypher = '' for s in text: if s.lower() not in alphabet: cypher += s.lower() continue cypher += alphabet[alphabet.index(s.lower()) - shift] return cypher