Write a function createDictFromListsLKeys LValues that retur
Write a function createDictFromLists(LKeys, LValues) that returns a dictionary with key:value pairs corresponding to the list objects in LKeys and LValues. For example, if LKeys = [\'a\', \'b\', \'c\', \'d\'] and LValues = [97, 98, 99, 100], then createDictFromLists(LKeys, LValues) should return the dictionary {\'a\':97, \'b\':98, \'c\':99, \'d\':100).
Solution
Please find the required program along with its output. Please see the comments against each line to understand the step.
def createDicFromLists(LKeys,LValues):
dic = {} #initialize empty dictionary
for i, val in enumerate(LKeys): #iterate over all keys in LKeys list
dic[val] = LValues[i] #add each key value entry into dictionary
return dic #return dictionary
print (createDicFromLists([\'a\',\'b\',\'c\',\'d\'],[97,98,99,100]))
-------------------------------------------
OUTPUT:
