Question: The following corresponds to python programming. Will upvote. 1) Write a function, make_dict(keys,values) that performs the following tasks. This function receives two lists keys and

The following corresponds to python programming. Will upvote.

1) Write a function, make_dict(keys,values) that performs the following tasks.

  • This function receives two lists keys and values as arguments.

  • It returns a dictionary using these two lists, pairing corresponding items.

  • The function should test if the number of elements in two lists is the same. If not, it should print "Error: the lengths of two lists are not the same"

a) # Complete the following function BELOW FULLY. DO NOT CHANGE THE FUNCTION NAME AND ARGUMENTS!

def make_dict(keys, values): if len(keys) != else

-------------

# The following code is provided for your test, You can modify it as you want, to test your function. k = ['a','b','c','d'] v = [1,2,3,4] d = make_dict(k,v) print(d) print(' ') k = ['A','B','C'] v = [[1,2,3], ['n','m','p','q','x'], ['USA', 'China', 'Chile', 'Kenya']] d = make_dict(k,v) print(d)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!