2018-12-01 - Chronal Calibration
(original .ipynb)puzzle_input_lines = open("puzzle_input/day1.txt").readlines() def part_one(input_lines): changes = [int(s) for s in input_lines] return sum(changes) print("part one:", part_one(puzzle_input_lines))
part one: 582
# v-e-r-y slow def part_two(input_lines): frequencies = [] current_frequency = 0 while True: for change in [int(s) for s in input_lines]: if (current_frequency in frequencies): return current_frequency frequencies.append(current_frequency) current_frequency += change return None print("part two:", part_two(puzzle_input_lines))
part two: 488