DAS_2024_1/kosheev_maksim_lab_2/worker-2/main.py

14 lines
527 B
Python
Raw Normal View History

2024-11-11 23:36:39 +04:00
input_file = '/var/data/data.txt'
output_file = '/var/result/result.txt'
2024-11-11 23:34:00 +04:00
2024-11-11 23:36:39 +04:00
def find_square_of_max(input_path, output_path):
with open(input_path, 'r') as infile:
numbers = [int(line.strip()) for line in infile if line.strip().isdigit()]
if numbers:
max_number = max(numbers)
square_of_max = max_number ** 2
with open(output_path, 'w') as outfile:
outfile.write(str(square_of_max))
2024-11-11 23:34:00 +04:00
if __name__ == "__main__":
2024-11-11 23:36:39 +04:00
find_square_of_max(input_file, output_file)