Skip to content

Commit

Permalink
day2
Browse files Browse the repository at this point in the history
we begin
  • Loading branch information
lab57 committed Dec 2, 2022
0 parents commit cd4fe89
Show file tree
Hide file tree
Showing 4 changed files with 4,794 additions and 0 deletions.
11 changes: 11 additions & 0 deletions day1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
with open("day1.txt", "r") as file:
spl = file.read().split("\n\n")
values = []
for i, elf in enumerate(spl):
cals = 0
for item in elf.split("\n"):
cals += int(item)
values.append(cals)
values.sort(reverse=True)
print(f"Part 1: {values[0]}")
print(f"Part 2: {values[0] + values[1] + values[2]}")
Loading

0 comments on commit cd4fe89

Please sign in to comment.