Created
January 17, 2020 20:09
-
-
Save nclv/ad1227f748e2603950587d08c54225dc 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
def iterate(iterable, n): | |
first = [] | |
for second in iterable: | |
first.append(second) | |
if len(first) == n: | |
yield first | |
first.pop(0) | |
yield first | |
def main(): | |
for element in iterate(["a", 45, None, 0, (4,5), [1]], 4): | |
print(element) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment