summaryrefslogtreecommitdiff
path: root/09/main.py
diff options
context:
space:
mode:
Diffstat (limited to '09/main.py')
-rwxr-xr-x09/main.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/09/main.py b/09/main.py
index 7fb235f..f53b218 100755
--- a/09/main.py
+++ b/09/main.py
@@ -17,8 +17,10 @@ for line in sys.stdin:
derivatives.append(derivative(derivatives[-1]))
prediction = 0
+ sign = 1
for d in derivatives:
- prediction += d[-1]
+ prediction += d[0] * sign
+ sign *= -1
output += prediction