subject

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`.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 24.06.2019 14:00
Which computer tools allow you to communicate with coworkers, family,and friends
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
You will subnet the network address 172.31.103.0/24. the network has the following requirements: · room-114 lan will require 27 host ip addresses · room-279 lan will require 25 host ip addresses · room-312 lan will require 14 host ip addresses · room-407 lan will require 8 host ip addresses how many subnets are needed in the network topology?
Answers: 2
question
Computers and Technology, 25.06.2019 01:00
Your computer will organize files into order. alphabetical chronological size no specific
Answers: 2
You know the right answer?
Create a function called addressbook that takes as input two dictionaries, name_to_phone and name_to...
Questions
question
Mathematics, 20.10.2020 02:01
question
English, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
English, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
Biology, 20.10.2020 02:01
Questions on the website: 13722362