From 720b235d6654ce08461d3664cda83a37141f92c1 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 2 Dec 2025 12:20:10 -0800 Subject: [PATCH] 2025 01 --- Python/2025/01/main.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Python/2025/01/main.py diff --git a/Python/2025/01/main.py b/Python/2025/01/main.py new file mode 100644 index 0000000..c6922f8 --- /dev/null +++ b/Python/2025/01/main.py @@ -0,0 +1,38 @@ +input = open("input", 'r') + +rotations = [] + +for i, line in enumerate(input): + rotations.append((line[0], int(line[1:]))) + +password = 0 +password_CLICK = 0 +dial = 50 + +# print("The dial starts by pointing at", dial) +for direction, length in rotations: + clicks = length // 100 + length = length % 100 + length *= 1 if direction == "R" else -1 + + dial_new = dial + length + + if (dial_new < 0 < dial) or \ + (dial < 100 < dial_new): + clicks += 1 + + dial = dial_new % 100 + + password_CLICK += clicks + if dial == 0: + password += 1 + password_CLICK += 1 + + # if clicks == 0: + # print("The dial is rotated", length, "to point at", dial) + # else: + # print("The dial is rotated", length, "to point at", dial, + # "| during this rotation, it points at 0:", clicks, "times") + +print(password) +print(password_CLICK)