X-Git-Url: https://git.sommitrealweird.co.uk/advent-of-code-2020.git/blobdiff_plain/a2ce7bb47964e226d4b10b791a038ca1f1fa67d7..fe0197cb1dc8f701b69ce52b9acb445351557c8d:/day01/find_2020_factors.py?ds=sidebyside diff --git a/day01/find_2020_factors.py b/day01/find_2020_factors.py new file mode 100644 index 0000000..5e5c54f --- /dev/null +++ b/day01/find_2020_factors.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 + +import sys + +data = [int(a) for a in open("input.txt", "r").read().split("\n") if a != ''] + +for i in range(0,len(data)-2): + for j in range(i+1,len(data)-1): + if data[i] + data[j] == 2020: + print("Match found: ", data[i], " + ", data[j], " = 2020") + print("Multiplied: ", data[i] * data[j]) + sys.exit(0)