Skip to content

Instantly share code, notes, and snippets.

@binki
Created May 28, 2019 19:01
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 binki/59934435d40ba94078f1e47b2675a7f4 to your computer and use it in GitHub Desktop.
Save binki/59934435d40ba94078f1e47b2675a7f4 to your computer and use it in GitHub Desktop.
# Apparently there’s a thing called cycle() for this in python:
>>> x = ['a', 'b', 'c']
>>> [x[i % len(x)] for i in range(0, 20)]
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment