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.

Switch parameter order in parse_line function

+3 -3
+1 -1
2016/day04.py
··· 16 16 north_pole_sector_id = None 17 17 18 18 for line in fileinput.input(): 19 - name, sector, checksum = parse_line(line, r'(\S+)-(\d+)\[(\w{5})\]') 19 + name, sector, checksum = parse_line(r'(\S+)-(\d+)\[(\w{5})\]', line) 20 20 sector = int(sector) 21 21 22 22 real_name = ''.join(decrypt(c, sector) for c in name)
+1 -1
2016/starter.py
··· 23 23 # data = [x for x in line.split(', ')] 24 24 # data = [x for x in line] 25 25 # data = [int(x) for x in line.split()] 26 - data = parse_line(line, r'') 26 + data = parse_line(r'', line) 27 27 28 28 if i == 0: 29 29 print(data)
+1 -1
2016/utils.py
··· 9 9 CONSONANTS = set(x for x in LETTERS if x not in VOWELS) 10 10 11 11 12 - def parse_line(line, regex): 12 + def parse_line(regex, line): 13 13 return re.match(regex, line).groups() 14 14 15 15