From c52fe0aa76f777d1957f911d04533c0ca1fbf8ab Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 1 Dec 2020 09:14:04 +0100 Subject: [PATCH] Complete 2020 day 1 part 2 --- 2020/day01-expense.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/2020/day01-expense.py b/2020/day01-expense.py index c16da5a..471d5fd 100644 --- a/2020/day01-expense.py +++ b/2020/day01-expense.py @@ -8,9 +8,11 @@ def main(): for i, value in enumerate(lines): for j in range(i+1, stop): other = lines[j] - addition = other + value - if addition == 2020: - print("result is", other * value) + for k in range(j+1, stop): + third = lines[k] + addition = other + value + third + if addition == 2020: + print("result is", other * value * third) if __name__ == '__main__':