Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

=+ What may stay the same?

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago

Question

Define capital structure.

Answered: 1 week ago