Created
December 1, 2022 08:58
-
-
Save grabovszky/2d5ad4fdacdbef6040c6648f73131d42 to your computer and use it in GitHub Desktop.
Advent of Code 2022 Day 1 Task 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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