aoc/01/01.py

23 lines
460 B
Python
Raw Normal View History

2020-12-02 13:11:58 +00:00
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()