Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function named find _ contact to meet the following requirements: Take a contact dictionary as a positional parameter. Take a find as a

Define a function named find_contact to meet the following requirements:
Take a contact dictionary as a positional parameter.
Take a find as a keyword parameter.
Create an empty dictionary.
If find is a numeric value and contained as a key in the dictionary, add the key:value pair to the created dictionary.
Loop through all the key:value pairs and if the find substring is contained in either the first name or last name, add the key:value pair to the created dictionary.
Sort the created dictionary in ascending order by last name, and then by first name, ignoring case.
Return the created dictionary.

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

Students also viewed these Databases questions