Day 03
This commit is contained in:
13
day03/part1.py
Normal file
13
day03/part1.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
lines = (x.strip() for x in open("input.txt"))
|
||||
s = 0
|
||||
|
||||
for line in lines:
|
||||
a = set(line[:len(line)//2])
|
||||
b = set(line[len(line)//2:])
|
||||
i = a.intersection(b)
|
||||
o = ord(i.pop())
|
||||
s += o-0x60 if o > 0x60 else o-38
|
||||
|
||||
print(s)
|
||||
Reference in New Issue
Block a user