The program creates a dictionary by combining two lists. The first list "keys" contains the keys for the dictionary and the second list "values" contains the corresponding values. The zip function takes two or more lists as input and returns an iterable of tuples, where the i-th tuple contains the i-th element from each of the input lists.
In this case, the zip function is used to combine the "keys" list and "values" list, resulting in an iterable of tuples with the first element of each tuple being a key and the second element being its corresponding value. Finally, the dict function is used to convert the iterable of tuples into a dictionary. The resulting dictionary is stored in the variable "res" and printed using the print function.
keys = ["One", "Two", "Three", "Four", "Five"] values = [1, 2, 3, 4, 5] res = dict(zip(keys, values)) print(res)
{'Name': 'Ram', 'Age': 25, 'City': 'Salem', 'Gender': 'Male', 'Mark': 422, 'Percent': 84.4}
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions