From 6ccbdfeacdc38305650993319cf102e8b0c9cf6b Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 3 Dec 2022 02:54:52 +0100 Subject: [PATCH] 2022 - Day 2 part 2 --- 2022/2/2_2.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 2022/2/2_2.py diff --git a/2022/2/2_2.py b/2022/2/2_2.py new file mode 100644 index 0000000..add898b --- /dev/null +++ b/2022/2/2_2.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# 2022 - Advent Of Code 2 - part 2 + +# file = 'input_example.txt' +file = 'input.txt' + +score = { + 'AX': 3, + 'AY': 4, + 'AZ': 8, + 'BX': 1, + 'BY': 5, + 'BZ': 9, + 'CX': 2, + 'CY': 6, + 'CZ': 7 +} + +with open(file, encoding="utf-8") as f: + cur_score = 0 + for line in f.readlines(): + hand = line.strip().replace(' ', '') + cur_score += score[hand] + + print(cur_score) + \ No newline at end of file