Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit ca452ad

Browse files
committed
Solve part2 day one
1 parent 2325f42 commit ca452ad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

day1/part2.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def solve(inp):
2+
sum = 0
3+
length = len(inp)
4+
5+
for idx, val in enumerate(inp):
6+
cmp = int((idx + (length / 2)) % length)
7+
if (val == inp[cmp]):
8+
sum = sum + int(val)
9+
10+
return sum
11+
12+
def main():
13+
inp = input('[?] The puzzle input: ')
14+
print(solve(inp))
15+
16+
17+
if __name__=='__main__':
18+
main()

0 commit comments

Comments
 (0)