From d93174c493ed0443c684b94d1c96c8daf88a7684 Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Mon, 4 Dec 2023 15:44:48 +0100 Subject: [PATCH] Finished 2015-12-02 part 1 --- 2015/day2/part1.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/2015/day2/part1.py b/2015/day2/part1.py index 1dc99ac..f58fd59 100644 --- a/2015/day2/part1.py +++ b/2015/day2/part1.py @@ -9,5 +9,13 @@ result = 0 with open(input_f) as file: for line in file: - tmp = line.split(x) - print(tmp) + tmp = line.rstrip().split('x') + tmp = list(map(int,tmp)) + first = tmp[0] * tmp[1] + second = tmp[1] * tmp[2] + third = tmp[2] * tmp[0] + #2*l*w + 2*w*h + 2*h*l + smallest = min(first,second, third) + #print(first,second, third, smallest) + result = result + (2*first) + (2*second) + (2*third) + smallest + print(result)