Coding-Riddles/secret_instructions.py

20 lines
390 B
Python
Raw Normal View History

2025-01-20 11:37:00 -05:00
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