Created
August 1, 2024 16:38
-
-
Save hernandohhoyos/fbb8c5ccd45e254471bd9afad7e17937 to your computer and use it in GitHub Desktop.
Lista con Iteración Infinita
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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