From 343e93b59df3cb50e997d3edf99d03a6528029a3 Mon Sep 17 00:00:00 2001 From: kwout Date: Thu, 1 Dec 2022 19:18:25 -0500 Subject: [PATCH] day 1 2022 wow --- 2022/day1/1.py | 14 ++++++++++++++ README.md | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 2022/day1/1.py diff --git a/2022/day1/1.py b/2022/day1/1.py new file mode 100644 index 0000000..3841ee4 --- /dev/null +++ b/2022/day1/1.py @@ -0,0 +1,14 @@ +lines = [i for i in open("input.txt", 'r').read().splitlines()] + +elves = [] +summa = 0 +for l in lines: + if l == "": + elves.append(summa) + summa = 0 + else: + summa += int(l) + +top3 = sorted(elves)[-3:] +print(top3) +print(sum(top3)) diff --git a/README.md b/README.md index 4538401..b6730b1 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ my solutions for the [Advent of Code](https://adventofcode.com/) in progress:\ 2021 (python) +2022 (python) planned:\ -2022 (swift)\ -2020 (rust?)\ +2020\ 2019\ 2018\ 2017\