subject

There's a roster of unique names, and we created a dictionary of first name to list of last names. For example, the roster Alice Chan Bob Smith Fred Agarwal Alice Smith We've created this dictionary mapping first name to a list of associated last names, but dumped the original roster unfortunately: {'Alice': ['Chan', 'Smith'], 'Bob': ['Smith'], 'Frei But now, we want to search by last name. So given only the above dictionary, return a new dictionary where the key is last name instead of first name. {'Chan': ['Alice'], 'Smith': ['Alice', 'Bob'], 'Aga A Few Notes: A Few Notes: 1. The order of the lists of first names is ambiguous, but return it sorted alphabetically from A-Z. That means, 'Smith' should map to ['Alice', 'Bob'], NOT ['Bob', 'Alice').
2. Even if there's only one person with that last name, make sure it's mapped to a list. That means, 'Agarwal should map to ['Fred'], NOT 'Fred'
3. Recall dictionaries (and sets) are unordered, so don't be alarmed if the print statement didn't have the last names in the same order as above. BUT, for each last name, the list of first names associated must be sorted.
4. We've assumed the original roster had unique names, so there aren't any issues with that. 1 def reverse_roster (fn_dict:dict) -> dict: 2 # TODO: Your code here (-10-20 lines of code) 3 4 if __name__ == '__main__':
5 sample = {'Alice': ['Smith', 'Chan'], 'Bob': ['Smith'], 'Fred': ['Agarwal']}
6 print (reverse_roster (sample))

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
You know the right answer?
There's a roster of unique names, and we created a dictionary of first name to list of last names. F...
Questions
question
Chemistry, 08.10.2019 12:10
question
Computers and Technology, 08.10.2019 12:20
Questions on the website: 13722363