How to zip two lists in Python

Zipping two lists pairs elements from the first list with elements from the second list. For example, zipping [1, 2, 3] and [4, 5, 6] results in [(1, 4), (2, 5), (3, 6)].

Solution for How to zip two lists in Python : You can use zip() to zip lists together Call zip(*iterables) with two lists as *iterables to construct a zip object. Use list() to convert the zip object to a list containing zipped pairs from the original two lists.


how-to-zip-two-lists-in-python