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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started