Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Python) Create a function named createDict that takes in two input parameters. The first input parameter is a list objects to be used as dictionary

(Python)

Create a function named "createDict" that takes in two input parameters. The first input parameter is a list objects to be used as dictionary keys. The second input parameter is a list of objects to be used as those keys' values. For example, calling createDict(['a', 1, 'w'], [[1,2,3], 'y', True]) would return {'a': [1,2,3], 1: 'y', 'w': True}

*you can assume that all the objects passed in the first parameter (the keys), will be valid dictionary keys - meaning they are all immutable types. This is important since a mutable object, like a list, can not be a dictionary key. The size of these two lists may not be the same. If there is no corresponding item in values for a given key, then the key's value should be -1 (integer). On the other hand, if there is no key for a given value, then the key should be # the string "unnamed" plus the index of the value in the values' list, e.g. 'unnamed3'

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_2

Step: 3

blur-text-image_3

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

Write out the sum. k2 k=1

Answered: 1 week ago