cur_cal = 0 max_cal = 0 with open("input", encoding="utf-8") as f: foods = f.readlines() for food in foods: if food == "\n": if cur_cal > max_cal: max_cal = cur_cal cur_cal = 0 else: cur_cal += int(food) print(f"highest calories is {max_cal}")