Solutions to Advent of Code 2017 https://adventofcode.com/2017/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456
  1. import itertools
  2. with open('data/13.txt', 'r') as file:
  3. layers = dict(map(lambda l: tuple(map(int, l.strip().split(': '))), file.readlines()))
  4. print(f'Part one: {sum(offset * length for offset, length in layers.items() if offset % ((length-1) * 2) == 0)}')
  5. print(f'Part two: {next(delay for delay in itertools.count() if all((offset + delay) % ((length - 1) * 2) != 0 for offset, length in layers.items()))}')