Question: Create a function called lists2Dictionary. It should take 2 lists as arguments. The function should return a dictionary where the keys are the items in

Create a function called lists2Dictionary. It should take 2 lists as arguments. The function should return a dictionary where the keys are the items in list1 and the values are the items in list2. Complete unit testing on the function. Example:

list1 = ['1','2','3','4']

list2 = ['v1','v2','v3','v4']

d = lists2Dictionary(list1,list2)

print d

Your function should consider the following unit tests (Include these after your function definition):

The lists are different sizes

List1 has a duplicate value

Blank lists

Lists of ints, floats, strings and booleans

*Include documentation in your function definition file which explains the function and behavior of at least the 4 unit tests above. Example : If the the lists are different sizes the dictionary will contain only the number of key/value pairs of the shorter list.

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!