aoc/2020/01/01.py
2020-12-10 17:11:17 -06:00

24 lines
463 B
Python

def read_file():
with open('input.txt','r') as f:
return [int(x) for x in f]
def part1(expenses):
for a in expenses:
for b in expenses:
if a + b == 2020:
return a*b
def part2(expenses):
for a in expenses:
for b in expenses:
for c in expenses:
if a + b + c == 2020:
return a*b*c
def main():
expenses = read_file()
print(f'Part 1: {part1(expenses)}')
print(f'Part 2: {part2(expenses)}')
if __name__ == "__main__":
main()