AdventOfCode/2022/day2/day2_part2.py

41 lines
754 B
Python
Raw Normal View History

2023-12-09 22:06:15 +01:00
import sys
arr = []
with open(sys.argv[1]) as f:
for l in f:
arr.append(l.split())
score = 0
total_score = 0
for x in arr:
#print(x)
if x[0] == 'A':
if x[1] == 'X':
score = (3+0)
elif x[1] == 'Y':
score = (1+3)
elif x[1] == 'Z':
score = (2+6)
if x[0] == 'B':
if x[1] == 'X':
score = (1+0)
elif x[1] == 'Y':
score = (2+3)
elif x[1] == 'Z':
score = (3+6)
if x[0] == 'C':
if x[1] == 'X':
score = (2+0)
elif x[1] == 'Y':
score = (3+3)
elif x[1] == 'Z':
score = (1+6)
#print (score)
total_score += score
score = 0
print(total_score)