Last active
February 20, 2020 16:22
-
-
Save norbertparti/7259ea4095086b5bf2140244082ad43a 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
#Merge even and odd numbers | |
even = (i for i in range(1,100) if i % 2 == 0) | |
odd = (i for i in range(1,100) if i % 2 != 0) | |
def imerge(a, b): | |
for i, j in zip(a,b): | |
yield i | |
yield j | |
print(list(imerge(even, odd))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment