/
angry_code
/
PYAPI_Homework_angry-code
Обзор
Документация
Войти
/
angry_code
/
PYAPI_Homework_angry-code
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
task_3.py
22 строки
736 B
angry_code
create: itog.txt, recipes.txt, task_3.py, 1.txt, 2.txt, 3.txt, exercise3_angry-code.py
26 апр 2026, 20:40
Верифицирован
26 апр 2026, 20:40
bde298f
Код
Авторство
О чём код?
with open("1.txt", encoding="UTF8") as f1, open("2.txt", encoding="UTF8") as f2, open( "3.txt", encoding="UTF8" ) as f3, open("itog.txt", "w", encoding="UTF8") as f4: lines_first = f1.readlines() length_file_first = len(lines_first) dict = {} dict[str(lines_first)] = "1.txt" lines_second = f2.readlines() length_file_second = len(lines_second) dict[str(lines_second)] = "2.txt" lines_third = f3.readlines() length_file_third = len(lines_third) dict[str(lines_third)] = "3.txt" files = [lines_first, lines_second, lines_third] sorted_files = sorted(files, key=len) for file in sorted_files: f4.write(f"{dict[str(file)]}\n{len(file)}\n{file}\n")