diff --git a/2023/9.py b/2023/9.py index 0328d0f..9b7cb47 100644 --- a/2023/9.py +++ b/2023/9.py @@ -1,11 +1,12 @@ input = [[int(i) for i in l.split()] for l in open("input.txt", 'r').read().splitlines()] -score = 0 - def diff(l): newList = [l[i+1] - l[i] for i in range(len(l)-1)] return l[-1] + diff(newList) if set(newList) != {0} else l[-1] + score = sum(diff(l) for l in input) +score2 = sum(diff(l[::-1]) for l in input) -print(score) \ No newline at end of file +print(score) +print(score2) \ No newline at end of file diff --git a/README.md b/README.md index 1fac45a..34c0d2d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ my solutions for the [Advent of Code](https://adventofcode.com/) in progress:\ 2021: 12/25\ -2022: 7/25\ -2023: 3/25 +2022: 8/25\ +2023: 9/25 planned:\ 2020\