AdventOfCode/2022/day2/day2_part1.py

40 lines
748 B
Python
Raw Normal View History

2023-12-09 22:06:15 +01:00
arr = []
with open('input') 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 += (1+3)
elif x[1] == 'Y':
score += (2+6)
elif x[1] == 'Z':
score += (3+0)
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 += (1+6)
elif x[1] == 'Y':
score += (2+0)
elif x[1] == 'Z':
score += (3+3)
#print (score)
total_score += score
score = 0
print(total_score)