This commit is contained in:
parent
837ce5ebae
commit
6ccbdfeacd
1 changed files with 26 additions and 0 deletions
26
2022/2/2_2.py
Normal file
26
2022/2/2_2.py
Normal file
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue