Dec-05-2022, 08:40 PM
(This post was last modified: Dec-05-2022, 08:40 PM by deanhystad.)
Your latest attempt can be compressed to a single loop,
with open("test.txt", "r") as file: sum_list = [] for line in file: if line != "\n": sum_list.append(int(line)) else: print(sum_list) sum_list = []Now get rid of sum_list because we don't need the list. We need the total.