Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Discuss the scope of Human Resource Management

Answered: 1 week ago

Question

Discuss the different types of leadership

Answered: 1 week ago

Question

Write a note on Organisation manuals

Answered: 1 week ago

Question

Define Scientific Management

Answered: 1 week ago

Question

Explain budgetary Control

Answered: 1 week ago