Answered step by step
Verified Expert Solution
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started