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.
18 lines
383 B
18 lines
383 B
f = open("input.txt", "r")
|
|
lines = f.read().splitlines()
|
|
|
|
|
|
def score(char):
|
|
if char.lower() == char:
|
|
return ord(char) - 96
|
|
else:
|
|
return ord(char) - 38
|
|
|
|
|
|
summed = 0
|
|
for i in range(0, len(lines), 3):
|
|
group = lines[i : i + 3]
|
|
symbol = list(set(group[0]).intersection(group[1]).intersection(group[2]))
|
|
summed = summed + score(symbol[0])
|
|
print(summed)
|