my solutions for advent of code 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
636 B

dicx = { "A": 3, "B": 0, "C": 6}
dicy = { "A": 6, "B": 3, "C": 0}
dicz = { "A": 0, "B": 6, "C": 3}
dics = { "X" : dicx, "Y": dicy, "Z": dicz}
def funcy(lett, tempi):
tempa = inp[tempi].replace(" "+lett, "")
return dics[lett][tempa]
score=0
f = open('input2.txt', 'r')
inp = f.readlines()
for i in range(len(inp)):
inp[i] = inp[i].strip()
if "X" in inp[i]:
score = score + 1
score = score + funcy('X', i)
elif "Y" in inp[i]:
score = score + 2
score = score + funcy('Y', i)
elif "Z" in inp[i]:
score = score + 3
score = score + funcy('Z', i)
print(score)