Explain Python’s zip() function.?
zip() function- it will take multiple lists say list1, list2, etc and transform them into a single list of tuples by taking the corresponding elements of the lists that are passed as parameters. Eg:
list1 = ['A', 'B','C'] and list2 = [10,20,30]. zip(list1, list2) # results in a list of tuples say [('A',10),('B',20),('C',30)]
whenever the given lists are of different lengths, zip stops generating tuples when the first list ends.