commit 5ec807336489aa62e46d6fbefd76c4e625ea8747 Author: Злата Сухова Date: Thu Mar 6 17:16:22 2025 +0000 Загрузить файлы в «/» 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 создан с расшифрованным текстом.")