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.

22 lines
430 B

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