""" ADVENT OF CODE: 2015 DAY: 7 AUTHOR: JOSEPH RICHARDSON """ from day07_2015_input import raw from day07_2015_input import test import gozer from collections import defaultdict dict_map = defaultdict(str) # If lines from a text input needs to be split into rows of a list inp = gozer.readlines(raw, to_int=False, to_np=False) inp_test = gozer.readlines(test, to_int=False, to_np=False, np_map=None) # PART 1 def fill_dict(data): for line in data: commands = line.split(' -> ') try: dict_map[commands[1]] = int(commands[0]) except: dict_map[commands[1]] = commands[0] def parse_command(key, command): if isinstance(command, int): return command
""" ADVENT OF CODE: 2021 DAY: 1 TIME: 9 MINUTES AUTHOR: JOSEPH RICHARDSON """ from day01_input import raw import gozer # If lines from a text input needs to be split into rows of a list inp = gozer.readlines(raw, to_int=True) # PART 1 def part1(): start = inp[0] count = 0 for i in range(1, len(inp)): this = inp[i] if this > start: count += 1 start = this return count # PART 2 def part2(): start = inp[0] + inp[1] + inp[2] count = 0