Coding-Riddles/secret_instructions.py
2025-01-20 11:37:00 -05:00

20 lines
No EOL
390 B
Python

last_direction = None
while True:
instruction = input()
if instruction == "99999":
break
direction = int(instruction[0]) + int(instruction[1])
amount = int(instruction[2:])
if amount == 0:
direction = last_direction
if direction % 2 == 0:
print("right", amount)
else:
print("left", amount)
last_direction = direction