Your question is Filter a List by Criteria. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Ashby may represent candidate records as dictionaries containing fields such as stage, location, and source. Given a list of candidate records and a criteria dictionary, return only the records whose values match every key-value pair in the criteria.
Implement filter_candidates(candidates, criteria).
candidates is a list of dictionaries mapping strings to comparable values.criteria is a dictionary mapping field names to required values.criteria, the candidate contains that key and its value equals the required value.criteria is empty, every candidate matches.def filter_candidates(candidates, criteria):