Skip to content

Instantly share code, notes, and snippets.

@grabovszky
Created December 1, 2022 08:58
Show Gist options
  • Save grabovszky/2d5ad4fdacdbef6040c6648f73131d42 to your computer and use it in GitHub Desktop.
Save grabovszky/2d5ad4fdacdbef6040c6648f73131d42 to your computer and use it in GitHub Desktop.
Advent of Code 2022 Day 1 Task 1
data = open("input.txt").read()
current_carried = 0
max_carried_by_one = 0
for food in data.split("\n"):
if len(food) == 0:
current_carried = 0
else:
current_carried += int(food)
max_carried_by_one = max(max_carried_by_one, current_carried)
print(max_carried_by_one)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment