Question: 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 findcontact 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
