advent/2020/1/solution.py
2021-07-20 12:53:28 -05:00

25 lines
607 B
Python

#!/usr/bin/python
fd = open("input", "r")
lines = fd.readlines()
lines = [i.rstrip() for i in lines]
mustbreak = False
def part1():
for i in lines:
for j in lines:
if int(i) + int(j) == 2020:
print("{} * {} = {}".format(int(i), int(j), int(i) * int(j)))
return
def part2():
for i in lines:
for j in lines:
for k in lines:
if int(i) + int(j) + int(k) == 2020:
print("{} * {} * {} = {}".format(int(i), int(j), int(k), int(i) * int(j) * int(k)))
return
part1()
part2()