diff options
author | Thomas Voss <thomasvoss@live.com> | 2021-12-01 06:16:25 +0100 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2021-12-01 06:16:25 +0100 |
commit | aafb97eb7f186c56992a0be6a50c4df4058bd4ed (patch) | |
tree | b8adbd307e52ec07ac6aecc013ea20710abba1bb /2021/01/puzzles.py | |
parent | 0bacf291012507634fed08df5ea2d7372c518a99 (diff) |
It is now 2021, so time to add more stuff
Also got the first solution of CSE, 5:30 gang.
Diffstat (limited to '2021/01/puzzles.py')
-rw-r--r-- | 2021/01/puzzles.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/2021/01/puzzles.py b/2021/01/puzzles.py new file mode 100644 index 0000000..0a894ca --- /dev/null +++ b/2021/01/puzzles.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +def main() -> None: + with open("input", "r") as f: + nums = [int(n) for n in f.readlines()] + + # START PART 2 + nums = [nums[i] + nums[i - 1] + nums[i - 2] for i in range(2, len(nums))] + # END PART 2 + print(sum(nums[i] > nums[i - 1] for i in range(1, len(nums)))) + +if __name__ == "__main__": + main() |