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.
AdventOfCode20/days/test_day01.py

22 lines
584 B

import os
import itertools
inputfile = os.path.join(os.path.dirname(__file__), "input/day01_input")
with open(inputfile) as file:
lines = [int(line.strip()) for line in file]
def test_day1a():
list_permutations = itertools.combinations(lines, 2)
for (a, b) in list_permutations:
if a + b == 2020:
result = a * b
assert result == 514579
def test_day1b():
list_permutations = itertools.combinations(lines, 3)
for (a, b, c) in list_permutations:
if a + b + c == 2020:
result = a * b * c
assert result == 241861950