Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

get_last_to_first: (dict[str, list[str]]) -> dict[str, list[str]] The parameter represents a person to friends dictionary. This function must return a last name to first names dictionary

get_last_to_first: (dict[str, list[str]]) -> dict[str, list[str]]

The parameter represents a "person to friends" dictionary. This function must return a "last name to first names" dictionary built from the data in the given dictionary. The keys in the returned dictionary should be the last names of people in the given dictionary. (Remember: every person has exactly one last name.) The values are lists of the first names (sorted in alphabetical order) of people with a given last name.

The returned dictionary should contain every person whose name appears in the given dictionary: the person's last name as one of the dictionary keys, and the person's first name as an element in one of the dictionary values. Names in the list should be unique: no one should be listed more than once. Use method list.sort to put the lists of first names into alphabetical order.

image text in transcribedimage text in transcribed
\f\f

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions