advent_of_code/2020/01/result2.py

29 lines
670 B
Python

import collections
sum = 2020
eingabe = []
with open('./input.txt') as f:
for line in f:
eingabe.append(int(line))
# print(eingabe)
sumtable = []
for summ1 in eingabe:
for summ2 in eingabe:
suche = 2020 - (summ1+summ2)
if suche in eingabe:
if suche not in sumtable:
sumtable.append(suche)
print('{} + {} + {} = {}'.format(summ1, summ2, suche, int(summ1)+int(summ2)+int(suche)))
print('found')
print(eingabe, len(eingabe))
print(sumtable)
print('{} * {} * {} = {}'.format(sumtable[0], sumtable[1], sumtable[2], sumtable[0]*sumtable[1]*sumtable[2]))