with open('input') as f: list_array = f.readlines() sun_array = [] count = 0 temp = 0 max = 0 for x in list_array: if x != '\n': temp += int(x) else: print('total: ' + str(temp)) if temp > max: max = temp temp = 0 print('total: ' + str(temp)) print('The Elf with the most Calories carry ' + str(max))