My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 18 lines 417 B view raw
1import fileinput 2 3digits = [int(x) for x in fileinput.input()[0].strip()] 4dlen = len(digits) 5half = dlen // 2 6 7fst_total = 0 8snd_total = 0 9 10for i in range(len(digits)): 11 if digits[i] == digits[(i + 1) % dlen]: 12 fst_total += digits[i] 13 14 if digits[i] == digits[(i + half) % dlen]: 15 snd_total += digits[i] 16 17print "Solution to first captcha:", fst_total 18print "Solution to second captcha:", snd_total