DAS_2024_1/kosheev_maksim_lab_2/worker-2/main.py

14 lines
527 B
Python

input_file = '/var/data/data.txt'
output_file = '/var/result/result.txt'
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))
if __name__ == "__main__":
find_square_of_max(input_file, output_file)