Question: [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.
![[PYTHON] I need help fixing the errors. Finish the function get_names that](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f541f9f0a83_24166f541f959aed.jpg)
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 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
