From dbc42a5a231f3ffd18af571d8b358735a1f831f1 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 1 Dec 2022 20:19:35 +0100 Subject: day 1 in python demoing some stuff for a friend --- 22.1/main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 22.1/main.py diff --git a/22.1/main.py b/22.1/main.py new file mode 100644 index 0000000..26a7727 --- /dev/null +++ b/22.1/main.py @@ -0,0 +1,14 @@ +from sys import stdin + +best = [] +done = False +while not done: + done = True + total = 0 + for line in stdin: + done = False + line = line.strip() + if line == "": break + total += int(line) + best = sorted([total] + best)[-3:] +print(best[-1], sum(best)) -- cgit 1.4.1-2-gfad0