You can download this code by clicking the button below.
This code is now available for download.
The function implements similar functionality to the zip function, but fills shorter sequences with fillvalue when the lengths of sequences are different.
Technology Stack : Built-in library - collections
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=None):
zip_longest_func = zip_longest(*args, fillvalue=fillvalue)
for item in zip_longest_func:
yield item