Day 1: Add Py3 solution
This commit is contained in:
parent
f1779d53d4
commit
473bc79995
1 changed files with 9 additions and 0 deletions
9
01/solution.py
Executable file
9
01/solution.py
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
with open("input.txt", "r") as _input:
|
||||||
|
data = [int(l) for l in _input.readlines()]
|
||||||
|
|
||||||
|
sliding_sums = [sum(v) for v in zip(data, data[1:], data[2:])]
|
||||||
|
answer = [b > a for a, b in zip(sliding_sums, sliding_sums[1:])].count(True)
|
||||||
|
|
||||||
|
print(f"Answer: {answer}")
|
Loading…
Reference in a new issue