import os # Variant 1 def solve(dir_input, dir_result, filename_result): file_input = open(os.path.join(dir_input, 'data.txt')) inputs = [int(line) for line in file_input.readlines()] if inputs: result = max(inputs) ** 2 file_result = open(os.path.join(dir_result, filename_result), "w") file_result.write(str(result)) file_result.close() if __name__ == "__main__": solve("/var/result", '/var/result', 'result.txt')