My issue
error mistake can identify
My code
def user_function():
# Open the file for reading
file_path = "/mnt/codechef/numbers.txt"
sum_val = 0
try:
with open(file_path, 'r') as reader:
for line in reader:
num = int(line.strip())
sum_val += num
# Close the file
print("Sum:", sum_va)
except IOError as e:
print(e)
Learning course: Python Programming
Problem Link: Coding problem - 2 in Python Programming