¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
How can this program be converted to repeat using itertools and terminate definitely
from itertools import cycle, count states=["Kogi","Niger","Lagos"] for i in cycle(states): print(i)
2 Respuestas
+ 1
Tibor Santa . Many thanks.
0
from itertools import cycle, count
states=["Kogi","Niger","Lagos"]
for c, i in zip(count(), cycle(states)):
print(i)
if c > 20:
break