aoc/01/01.py
2020-12-02 07:11:58 -06:00

23 lines
460 B
Python

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