Computers and Technology

Create a function called addressbook that takes as input two dictionaries, name_to_phone and name_to_address, and combines them into a single dictionary address_to_all that contains the phone number of, and the names of all the people who live at, a given address. Specifically, your function should: a. Have input arguments `addressbook(name_to_phone, name_to_address)`, expecting `name_to_phone` as a dictionary mapping a name (string) to a home phone number (integer or string), and `name_to_address` as a dictionary mapping a name to an address (string).
b. Create a new dictionary `address_to_all` where the keys are all the addresses contained in `name_to_address`, and the value `address_to_all[address]` for `address` is of the format `([name1,name2,...], phone)`, with `[name1,name2,...]` being the list of names living at `address` and `phone` being the home phone number for `address`. **Note**: the *value* we want in this new dictionary is a *tuple*, where the first element of the tuple is a *list* of names, and the second element of the tuple is the phone number. (Remember that while a tuple itself is immutable, a list within a tuple can be changed dynamically.)
c. Handle the case where multiple people at the same address have different listed home phone numbers as follows: Keep the first number found, and print warning messages with the names of each person whose number was discarded.
d. Return `address_to_all`.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:00, azainababbas
Sam is a data analyst at an advertising firm. he often uses a spreadsheet that contains media ratings details. he would like to filter the spreadsheet data based on different filter criteria. which operators can he use to specify the combination of filter criteria? sam can use the ( blank ) operators to specify a combination of filter criteria.
Answers: 3
image
Computers and Technology, 23.06.2019 04:20, milkshakegrande101
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy. a. a fire occurs on the premises, and the building isbadly damaged. b. a burglar steals some money and securities from anunlocked safe. c. a business computer is damaged by vandals whobreak into the shop after business hours. d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm. til
Answers: 2
image
Computers and Technology, 24.06.2019 14:00, Abrahamolve
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
image
Computers and Technology, 24.06.2019 15:30, taylorpayne525p8qxky
What is not a type of text format that will automatically be converted by outlook into a hyperlink?
Answers: 1
Do you know the correct answer?
Create a function called addressbook that takes as input two dictionaries, name_to_phone and name_to...

Questions in other subjects: