Create a ZIP File Using List in Python

Python program to create a zip file with example using list. This will create a zip and add the element as user requested in the program. Based on the iterable objects, the zip function returns an iterator of tuples. Zip produces an empty iterator if no parameters are given. Zip provides an iterator of tuples with each tuple having only one element if only a single iterable is given. Zip provides an iterator of tuples if several iterables are given, with each tuple including elements from all of the iterables.

number_list = [1, 2, 3]
str_list = ['a','b','c']
value = zip()
value_list = list(value)
print(value_list)
value = zip(number_list, str_list)
value_set = set(value)
print(value_set)

 

Output:

[]
{(3, ‘c’), (2, ‘b’), (1, ‘a’)}