My issue
code not running
My code
def user_function():
# Open files in respective modes
input_filename = "/mnt/codechef/input.txt"
output_filename = "/mnt/codechef/output.txt"
try:
with open(input_filename, "r") as input_file, open(output_filename, "w") as output_file:
# Read and write the numbers from the file
for line in input_file:
number = int(line.strip())
# Display the contents of output.txt
with open(output_filename,"r") as output_file:
for line in output_file:
print(line.strip())
except IOError as e:
print("An error occurred:", e)
Learning course: Python Programming
Problem Link: Read, do operations and output to another file in Python Programming