primeiro commit com exercicios de Exercism realizados até esta data

This commit is contained in:
2026-10-17 22:10:27 +01:00
commit 58fccbe27a
708 changed files with 35038 additions and 0 deletions
@@ -0,0 +1,24 @@
def commands(binary_str):
list_of_commands: list = [
0,
"jump",
"close your eyes",
"double blink",
"wink",
]
order_of_commands: list = []
reverse_flag: bool = False
for index, code in enumerate(binary_str):
# if code is a '1', append the corresponded command to the order_of_commands
# unless the index is 0: in that case set the reverse_flag to True
# keep in mind i am searching for commands from left to right, so the order
# of commands is already reversed
if code == "1":
if index == 0:
reverse_flag = True
else:
order_of_commands.append(list_of_commands[index])
# do i want to keep it reversed?
if not reverse_flag:
order_of_commands.reverse()
return order_of_commands