From 4b9f07a09aa8af1bc254ccfab12ba3402dc29262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=81=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=91=D0=B0=D1=81?= =?UTF-8?q?=D0=B0=D1=80=D0=B3=D0=B8=D0=BD=D0=B0?= Date: Thu, 6 Mar 2025 16:47:02 +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 --- data.txt | 4 ++++ output.txt | 4 ++++ script.py | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 data.txt create mode 100644 output.txt create mode 100644 script.py diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..a89e6fe --- /dev/null +++ b/data.txt @@ -0,0 +1,4 @@ +Курогрудка +Творог +Йогурт +Огурцы \ No newline at end of file diff --git a/output.txt b/output.txt new file mode 100644 index 0000000..1716f40 --- /dev/null +++ b/output.txt @@ -0,0 +1,4 @@ +ЙОГУРТ +КУРОГРУДКА +ОГУРЦЫ +ТВОРОГ diff --git a/script.py b/script.py new file mode 100644 index 0000000..b36b9fb --- /dev/null +++ b/script.py @@ -0,0 +1,13 @@ +# Открываем data.txt и читаем содержимое +with open("data.txt", "r", encoding="utf-8") as file: + lines = file.readlines() + +# Преобразуем данные: переводим в верхний регистр и сортируем +processed_lines = sorted(line.strip().upper() for line in lines) + +# Записываем результат в output.txt +with open("output.txt", "w", encoding="utf-8") as file: + for line in processed_lines: + file.write(line + "\n") + +print("Файл output.txt успешно создан!")