Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[PYTHON] I need help fixing the errors. Finish the function get_names that takes a list of dictionaries and returns a list of strings with the
[PYTHON]
I need help fixing the errors.
Finish the function get_names that takes a list of dictionaries and returns a list of strings with the names from the dictionaries. The key for the first name is first and the key for the last name is las. Return a list of the full names (first last) as a string. If the first' or 'last key is missing in the dictionary use 'Unknown'. For example, [{'first': 'Ann', 'last': 'Brown'}, {'first': 'Darius'}] should return ['Ann Brown', 'Darius Unknown'] .. Run 2/16/2021, 1:19:29 PM - 4 of 4 Show in CodeLens 1 def get_names (d_list): 2 name_list = [] 3 for p_dict in d_list: 4 first = d_list.get('first', 'Unknown') 5 last = d_list.get('last', 'Unknown') 6 name = first + " " + last 7 name_list.append(name) 8 return name_list 9 10 11 12Step 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