Skip to content

Instantly share code, notes, and snippets.

@Kush1101
Last active October 27, 2020 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kush1101/b4521aec484c906ebda20ff850123f88 to your computer and use it in GitHub Desktop.
Save Kush1101/b4521aec484c906ebda20ff850123f88 to your computer and use it in GitHub Desktop.
from itertools import cycle
count = 0
iterable = ["Python", "is", "awesome."]
generator = cycle(iterable)
for i in range(6):
print(next(generator, end = ' ')
# OUTPUT
'''
Python is awesome. Python is awesome.
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment