Hi! A little bit late, I've start with AOC this year and waiting for tomorrow I've try the past event this is my solution in python for 2020 - DAY 1:
# PART01 - Find the two number that sum == T then multiply each other
# PART02 - Find the triplets that sum == T then multiply each other
fromitertoolsimportcombinationsfrommathimportprodI=list([int(x)forxinopen('input.txt','r').readlines()])T=2020# PART01
I2=[xforxincombinations(I,2)ifsum(x)==T]R_P01=prod([xforxinI2[0]])# PART02
I3=[xforxincombinations(I,3)ifsum(x)==T]R_P02=prod([xforxinI3[0]])
Very good content here Ryan!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi! A little bit late, I've start with AOC this year and waiting for tomorrow I've try the past event this is my solution in python for 2020 - DAY 1:
Very good content here Ryan!