From 5ec807336489aa62e46d6fbefd76c4e625ea8747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=97=D0=BB=D0=B0=D1=82=D0=B0=20=D0=A1=D1=83=D1=85=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Thu, 6 Mar 2025 17:16:22 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ README.md | 1 + data.txt | 1 + output.txt | 1 + script.py | 15 +++++++++++++++ 5 files changed, 20 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 data.txt create mode 100644 output.txt create mode 100644 script.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8901f05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.venv/ +output.txt \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e65efe --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +a \ No newline at end of file diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..b8f11f3 --- /dev/null +++ b/data.txt @@ -0,0 +1 @@ +17 18 10 3 6 20 14 10 18 \ No newline at end of file diff --git a/output.txt b/output.txt new file mode 100644 index 0000000..6fc6d2c --- /dev/null +++ b/output.txt @@ -0,0 +1 @@ +ПРИВЕТ МИР \ No newline at end of file diff --git a/script.py b/script.py new file mode 100644 index 0000000..c6f1025 --- /dev/null +++ b/script.py @@ -0,0 +1,15 @@ +# Создаём соответствие номеров букв и самих букв русского алфавита +alphabet = {i + 1: letter for i, letter in enumerate("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ")} + +# Читаем закодированный текст из файла data.txt +with open("data.txt", "r", encoding="utf-8") as file: + numbers = file.read().strip().split(" ") # Разделяем по одиночному пробелу, чтобы сохранить их + +# Преобразуем числа в буквы, а пробелы оставляем +decoded_text = "".join(alphabet.get(int(num), " ") if num.isdigit() else " " for num in numbers) + +# Записываем результат в output.txt +with open("output.txt", "w", encoding="utf-8") as output_file: + output_file.write(decoded_text) + +print("Файл output.txt создан с расшифрованным текстом.")