Solutions to Advent of Code 2017 https://adventofcode.com/2017/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

02.py 324B

12345
  1. import itertools
  2. with open('data/02.txt', 'r') as file:
  3. sheet = list(map(lambda row: list(map(int, row.split('\t'))), file.readlines()))
  4. print(f'Part one: {sum(max(row) - min(row) for row in sheet)}')
  5. print(f'Part two: {sum(next(a//b for a,b in itertools.permutations(row, 2) if a % b == 0) for row in sheet)}')