Complete 2020 day 1 part 2

This commit is contained in:
Gabriel Augendre 2020-12-01 09:14:04 +01:00
parent 37c8a76c72
commit c52fe0aa76
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4

View file

@ -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__':