Created
May 28, 2019 19:01
-
-
Save binki/59934435d40ba94078f1e47b2675a7f4 to your computer and use it in GitHub Desktop.
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
# 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