-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit adc99cc
Showing
17 changed files
with
8,054 additions
and
0 deletions.
There are no files selected for viewing
2,251 changes: 2,251 additions & 0 deletions
2,251
Advent_Of_Code_2022/day1/adventofcode20222_day1_data.csv
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data = [lst.strip() for lst in open("adventofcode20222_day1_data.csv")] | ||
totals, total = [], 0 | ||
for calories in data: | ||
if calories == "": | ||
totals.append(total) | ||
total = 0 | ||
else: | ||
total += int(calories) | ||
totals = sorted(totals) | ||
print(totals[-1], totals[-1] + totals[-2] + totals[-3]) |
Oops, something went wrong.