2
1
Fork 0

Day 1: Add Py3 solution

This commit is contained in:
Mia Herkt 2021-12-01 10:42:43 +01:00
parent f1779d53d4
commit 473bc79995
Signed by: mia
GPG key ID: 72E154B8622EC191

9
01/solution.py Executable file
View 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}")