DAS_2024_1/alkin_ivan_lab_2/worker-2/main.py
2024-12-09 23:49:29 +04:00

24 lines
597 B
Python

# worker-2/main.py
def find_min_number(filename):
with open(filename, 'r') as file:
numbers = [int(line.strip()) for line in file.readlines()]
min_number = min(numbers)
return min_number
def main():
input_file = '/var/data/data.txt'
output_file = '/var/result/result.txt'
min_number = find_min_number(input_file)
result = min_number ** 3 # Cube of the minimum number
with open(output_file, 'w') as file:
file.write(str(result))
print(f"Minimum number's cube: {result} written to {output_file}")
if __name__ == "__main__":
main()