Created
September 23, 2021 20:16
-
-
Save conformist-mw/0e48918be7aeefe607f3c5053fe37b94 to your computer and use it in GitHub Desktop.
This file contains 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
l = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] | |
a = ['a','b','c','d','e','f'] | |
for step in range(1, 6): | |
step_result = [] | |
letters = iter(cycle(a)) | |
for index, num in enumerate(l, 1): | |
step_result.append(num) | |
if not index % step: | |
step_result.append(next(letters)) | |
print(step_result) | |
[0, 'a', 1, 'b', 2, 'c', 3, 'd', 4, 'e', 5, 'f', 6, 'a', 7, 'b', 8, 'c', 9, 'd', 10, 'e', 11, 'f', 12, 'a', 13, 'b', 14, 'c', 15, 'd', 16, 'e', 17, 'f', 18, 'a', 19, 'b', 20, 'c', 21, 'd', 22, 'e', 23, 'f', 24, 'a', 25, 'b', 26, 'c', 27, 'd', 28, 'e', 29, 'f', 30, 'a'] | |
[0, 1, 'a', 2, 3, 'b', 4, 5, 'c', 6, 7, 'd', 8, 9, 'e', 10, 11, 'f', 12, 13, 'a', 14, 15, 'b', 16, 17, 'c', 18, 19, 'd', 20, 21, 'e', 22, 23, 'f', 24, 25, 'a', 26, 27, 'b', 28, 29, 'c', 30] | |
[0, 1, 2, 'a', 3, 4, 5, 'b', 6, 7, 8, 'c', 9, 10, 11, 'd', 12, 13, 14, 'e', 15, 16, 17, 'f', 18, 19, 20, 'a', 21, 22, 23, 'b', 24, 25, 26, 'c', 27, 28, 29, 'd', 30] | |
[0, 1, 2, 3, 'a', 4, 5, 6, 7, 'b', 8, 9, 10, 11, 'c', 12, 13, 14, 15, 'd', 16, 17, 18, 19, 'e', 20, 21, 22, 23, 'f', 24, 25, 26, 27, 'a', 28, 29, 30] | |
[0, 1, 2, 3, 4, 'a', 5, 6, 7, 8, 9, 'b', 10, 11, 12, 13, 14, 'c', 15, 16, 17, 18, 19, 'd', 20, 21, 22, 23, 24, 'e', 25, 26, 27, 28, 29, 'f', 30] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment