19 lines
685 B
Python
19 lines
685 B
Python
import os
|
||
|
||
# Указание путей к файлу данных и результирующему файлу
|
||
data_file = "/var/result/data.txt"
|
||
result_file = "/var/result/result.txt"
|
||
|
||
def power_greatest_number(source_file, result_file):
|
||
with open(source_file, mode="r") as file:
|
||
largest_number = max(int(number) for number in file.readlines())
|
||
|
||
with open(result_file, mode="w") as file:
|
||
file.write(str(largest_number ** 2))
|
||
|
||
print(f"В файл {result_file} записано наибольшее число во второй степени из файла {source_file}")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
power_greatest_number(data_file, result_file)
|