Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

Students also viewed these Databases questions

Question

How much sales tax did Dillards pay in South Carolina (SC)?

Answered: 1 week ago