diff --git a/2025/day02/part1.py b/2025/day02/part1.py new file mode 100644 index 0000000..185607d --- /dev/null +++ b/2025/day02/part1.py @@ -0,0 +1,16 @@ +import math +text: str + +with open("input.txt") as f: + text = f.read() + +total: int = 0 +for start, stop in [line.split("-") for line in text.split(",")]: + for value in range(int(start), int(stop) + 1): + length: int = int(math.log10(value)) + if length % 2 == 1: + value_str: str = str(value) + if (value_str[0:length // 2 + 1] == value_str[length // 2 + 1:]): + total += value + +print(total) \ No newline at end of file