2022 - Day 2 part 1
This commit is contained in:
parent
7cd33c640e
commit
837ce5ebae
3 changed files with 2528 additions and 0 deletions
25
2022/2/2.py
Normal file
25
2022/2/2.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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)
|
2500
2022/2/input.txt
Normal file
2500
2022/2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
3
2022/2/input_example.txt
Normal file
3
2022/2/input_example.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
A Y
|
||||||
|
B X
|
||||||
|
C Z
|
Loading…
Reference in a new issue