23 lines
460 B
Python
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()
|