advent_of_code/2022/2/2.py

26 lines
416 B
Python
Raw Permalink Normal View History

2022-12-03 02:41:39 +01:00
#!/usr/bin/env python
# 2022 - Advent Of Code 2
# file = 'input_example.txt'
file = 'input.txt'
score = {
'AX': 4,
'AY': 8,
'AZ': 3,
'BX': 1,
'BY': 5,
'BZ': 9,
'CX': 7,
'CY': 2,
'CZ': 6
}
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)