2025(01): create snippet for code

This commit is contained in:
2025-12-01 09:15:18 +01:00
parent a07af7efe9
commit 9b3e63be81

20
2025/01/part1.py Normal file
View File

@ -0,0 +1,20 @@
# TODO: Get the inout.
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)