2025(01): create snippet for code
This commit is contained in:
20
2025/01/part1.py
Normal file
20
2025/01/part1.py
Normal 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)
|
||||||
Reference in New Issue
Block a user