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.

24 lines
450 B

2 years ago
from string import ascii_letters as lett
value = {}
score = 0
x = 0
for i in range(len(lett)):
value[lett[i]] = i+1
f = open('input3.txt', 'r')
inp = f.read().splitlines(keepends=False)
while x < len(inp):
fir = inp[x]
sec = inp[x+1]
thi = inp[x+2]
for i in range(len(fir)):
if fir[i] in sec and fir[i] in thi:
charr = fir[i]
break
score = score + value[charr]
x = x + 3
print(score)