from part1 import solution from test_common import sample assert solution(sample) == 7
from part1 import solution import io sample = io.StringIO("""ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in""") sol = solution(sample) assert sol == 2, f"Expected 2, got {sol}"
from part1 import solution with open('intcode.txt', 'r') as f: data = list(map(int, f.read().split(','))) for i in range(100): for j in range(100): if solution(data, i, j) == 19690720: print('Second part answer: %s' % str(100 * i + j)) break
#!/usr/bin/env python from part1 import solution import io assert solution(io.StringIO("""1721 979 366 299 675 1456 """)) == 514579