import os def find_min_and_count(input_filepath): if not os.path.exists(input_filepath): raise FileNotFoundError(f"Input file {input_filepath} not found!") with open(input_filepath, 'r') as f: numbers = [int(line.strip()) for line in f.readlines()] min_value = min(numbers) count = numbers.count(min_value) return min_value, count def save_result(count, output_filepath): with open(output_filepath, 'w') as f: f.write(str(count)) def main(): input_filepath = '/var/result/data.txt' output_filepath = '/var/result/result.txt' try: min_value, count = find_min_and_count(input_filepath) save_result(count, output_filepath) print(f"File ({min_value}) copied to {output_filepath}: {count}") except FileNotFoundError as e: print(e) if __name__ == "__main__": main()