2) Implement the following function. def to_dict (key_lst, val_tuple) : The function takes two arguments. The first is a
Posted: Fri May 20, 2022 1:47 pm
2) Implement the following function. def to_dict (key_lst, val_tuple) : The function takes two arguments. The first is a list of strings that contains the keys for a dictionary and the second is a tuple that contains the values for the same dictionary. Both the tuple and the list are of same length and are in same order. The function constructs the dictionary and returns it. Examples: to_dict(['ki', '2', 'k3'), (7, True, 'v3')) → {'ki': 7, 'k2': True, 'k3': 'v3'} to_dict(['keyl', 'key2', 'key3'), (0, 5, 0)) + ['keyi': 0, 'key2': 5, "key3': 0} to_dict([], 0)) r