From 2d6c25217802a1ef7527d2323adc4ed716707ed2 Mon Sep 17 00:00:00 2001 From: Sijmen Date: Thu, 1 Dec 2022 16:02:15 +0100 Subject: [PATCH] day01: Add Python --- .gitignore | 1 + day01.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 .gitignore create mode 100644 day01.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14140f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.in diff --git a/day01.py b/day01.py new file mode 100644 index 0000000..00e64df --- /dev/null +++ b/day01.py @@ -0,0 +1,7 @@ +import sys + +input = sys.stdin.read().strip().split("\n\n") +elves = sorted(sum(int(i) for i in elf.split("\n")) for elf in input) + +print("Part 1:", elves[-1]) +print("Part 2:", sum(elves[-3:]))