-
Notifications
You must be signed in to change notification settings - Fork 74
6214 Голенков В.А. Лаб.1 Вар.5 #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
lab_1/main.py
Outdated
| if command == "stat": | ||
| t2.print_stat(text, len(text)) | ||
| elif command == "exit": | ||
| return | ||
| elif len(command) == 2: | ||
| text = text.replace(command[0], command[1]) | ||
| else: | ||
| print("Ошибка: Такой команды не существует") | ||
| tools.save_txt(decrypted_path, text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
используйте match/case
https://docs.python.org/3/tutorial/controlflow.html#match-statements
lab_1/main.py
Outdated
| encrypted_text = t1.caesar_encrypt( | ||
| tools.read_txt(settings["original_t1"]), | ||
| settings["key"], | ||
| settings["alphabet"] | ||
| ) | ||
|
|
||
| # decrypted_text = t1.ceasar_decrypt( | ||
| # encrypted_text, | ||
| # settings["key"], | ||
| # settings["alphabet"] | ||
| # ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
для выбора режима используйте match/case
|
прочитайте файл readme п.5 |
Требовалось написать код для шифрования произвольного текста любым моноалфавитным методом подстановки или перестановки, а также провести дешифрование, используя метод частотного анализа.
В папке
task1находится код для первого задания, в папкеtask2- для второго. Файлtools.pyсодержит вспомогательный модуль предназначенный для работы с файлами JSON и TXT.Модуль
main.pyявляется точкой входа и содержит в себе все необходимые для выполнения задания вызовы функций из других модулей. Для запуска программы требуется написать в командной строкеpython main.py -sf <путь к файлу с настройками> -m <режим работы программы>. Режима работы два: task_1 и task_2.