Created
January 21, 2022 14:28
-
-
Save zerone0x/77abcf4a6b8795cca1bfd8e2f740fbdc to your computer and use it in GitHub Desktop.
generator of py
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 merge(a, b): | |
first_a, first_b = next(a), next(b) | |
while True: | |
if first_a == first_b: | |
yield first_a | |
first_a, first_b = next(a), next(b) | |
elif first_a < first_b: | |
yield first_a | |
first_a = next(a) | |
else: | |
yield first_b | |
first_b = next(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment