2021-07-07 23:42:14 -05:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
fd = open("input", "r")
|
|
|
|
lines = fd.readlines()
|
2021-07-20 12:53:28 -05:00
|
|
|
lines = [i.rstrip() for i in lines]
|
2021-07-07 23:42:14 -05:00
|
|
|
mustbreak = False
|
|
|
|
|
2021-07-20 12:53:28 -05:00
|
|
|
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()
|