commit 0cc09de42eb587f112285d06541294b379973039 Author: Елизавета Сюзева Date: Thu Mar 6 19:36:01 2025 +0300 Добавлены файлы data.txt и script.py diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..b6c26bd --- /dev/null +++ b/data.txt @@ -0,0 +1,5 @@ +Бананы +Творог +Йогурт +Вишня +Чай \ No newline at end of file diff --git a/script.py b/script.py new file mode 100644 index 0000000..ecc4cea --- /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 успешно создан!")