From a1cee84e60a5b4452fed36d119788ade03f75bea Mon Sep 17 00:00:00 2001 From: Denis Urs Rudolph Date: Mon, 15 Dec 2025 12:11:44 +0100 Subject: [PATCH] Door Two solved (with little help) --- Day1/doorTwo.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Day1/doorTwo.py diff --git a/Day1/doorTwo.py b/Day1/doorTwo.py new file mode 100644 index 0000000..ff78a5a --- /dev/null +++ b/Day1/doorTwo.py @@ -0,0 +1,24 @@ +file = open('/Users/mastermito/Dev/AdventOfCode/Day1/input.txt', 'r') + +sum = 0 + +lines = file.readlines() +ranges = lines[0].strip().split(',') + +for r in ranges: + start, end = r.split('-') + for num in range(int(start), int(end) + 1): + string = str(num) + for sublen in range(1, len(string)//2 + 1): + if len(string) % sublen != 0: + continue + match = True + for i in range(len(string)): + if string[i] != string[i % sublen]: + match = False + if match: + sum += num + break + + +print('Sum is: ', sum) \ No newline at end of file