8000 Renumber days 1-9 · nthistle/advent-of-code@0ee3cb8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ee3cb8

Browse files
committed
Renumber days 1-9
1 parent 1352d3f commit 0ee3cb8

File tree

18 files changed

+4244
-0
lines changed

18 files changed

+4244
-0
lines changed

day-01/day_1.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
with open("input.txt") as file:
3+
inp = file.read().strip()
4+
5+
inp = [int(x) for x in inp.split("\n")]
6+
print("Part 1:",sum(inp))
7+
8+
reached = set()
9+
rsum = 0
10+
11+
while rsum not in reached:
12+
for val in inp:
13+
reached.add(rsum)
14+
rsum += val
15+
if rsum in reached:
16+
print("Part 2:",rsum)
17+
break

0 commit comments

Comments
 (0)
0