Solución
solution.tsTypeScript
def count_attempts(guesses: list, target: int) -> int:
# Recorre los intentos con while y detente con break cuando encuentres el objetivo
attempts = 0
while True:
try:
if guesses[attempts] == target:
return attempts + 1
break
else:
attempts += 1
except IndexError:
return -1
0respuestas