Skip to content

Instantly share code, notes, and snippets.

@hernandohhoyos
Created August 1, 2024 16:38
Show Gist options
  • Save hernandohhoyos/fbb8c5ccd45e254471bd9afad7e17937 to your computer and use it in GitHub Desktop.
Save hernandohhoyos/fbb8c5ccd45e254471bd9afad7e17937 to your computer and use it in GitHub Desktop.
Lista con Iteración Infinita
infinite_loop_list = [1,2,3,4,5]
for i in range(len(infinite_loop_list)):
print(
(
infinite_loop_list[i % len(infinite_loop_list)] ,
infinite_loop_list[(i+1) % len(infinite_loop_list)],
infinite_loop_list[(i+2) % len(infinite_loop_list)]
)
)
# Resultado
# (1, 2, 3)
# (2, 3, 4)
# (3, 4, 5)
# (4, 5, 1)
# (5, 1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment