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": 1, "C": 2}
dicy = { "A": 1, "B": 2, "C": 3}
dicz = { "A": 2, "B": 3, "C": 1}
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 + 0
score = score + funcy('X', i)
elif "Y" in inp[i]:
score = score + 3
score = score + funcy('Y', i)
elif "Z" in inp[i]:
score = score + 6
score = score + funcy('Z', i)
print(score)