Files
adventofcode/2025/01/part1.py

24 lines
512 B
Python

# TODO: Get the inout.
with open("input", "r") as fp:
moves = fp.readlines()
counter = 50
code = 0
for move in moves:
direction, number = move[0], int(move[1:])
assert direction in ['L', 'R'], f"Direction should be left (L) or right (R), not '{direction}'"
assert number > 0, f"Number should be positive, not '{number}'"
if direction == 'L':
counter -= number
else:
counter += number
# If we get zero, let's store that.
if counter % 100 == 0:
code += 1
print("The actual password is:", code)