1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gregori [183]
2 years ago
6

A friend of Kenneth's invited him to a party but forgot to give him the address. Luckily, Kenneth is very organized and has two

dictionaries, one that contains names and phone numbers; and another one that contains phone numbers and addresses. However, Kenneth needs your help to make it easier to find an address from a name. To achieve this, you will create a function called phone2address that takes three parameters:
⢠the first one is a dictionary that has names as keys and phone numbers as values
⢠the second one is a dictionary that has phone numbers as keys and addresses as values;
⢠the third one is a string with a friend's name.

To complete this function, you need to:

⢠First, use the phonebook and friend's name to find the desired phone number) .
Second, use the phone number and address book to find the correct address;
⢠Finally, you should return the address.
Computers and Technology
1 answer:
gregori [183]2 years ago
4 0

Answer:

Explanation:

The following code is written in Python and creates the function as requested in the question...

def phone2address(phonebook, addressBook, friendName):

   phoneNumber = phonebook.get(friendName)

   address = addressBook.get(phoneNumber)

   return address

The function uses the dictionary (phonebook) to look for the friendName input as the key and then saves the phone number attached to that name in a variable called phoneNumber. Then we use that variable to search the addressBook dictionary to find the associated address and save it to the address variable. Finally, we return that address.

You might be interested in
I’m trying to get answers from Brainly and it’s not showing up. I’ve been refreshing the browser, but it’s the same. I’ve never
Westkost [7]

Answer:

We are having the same problem

Explanation:

7 0
3 years ago
Read 2 more answers
If I want to add a new slide to my presentation, which option would I click on?
ivanzaharov [21]
The answer would be D. New Slide
3 0
3 years ago
Can anyone suggest me any good complete isekai anime..​
Fofino [41]
I suggest you watch hentaaii my boyy


8 0
3 years ago
Read 2 more answers
This is more opinionated than question-based.
kozerog [31]

I think the Iphone is better the Google Pixels. That's just my opinion but some people like google pixels better.

7 0
3 years ago
Instant messaging is synchronous
ASHA 777 [7]
True; synchronous means existing or occurring at the same time (I really don't know if that's a question but oh well) 
7 0
3 years ago
Other questions:
  • In Linux Operating System, what file extension is used forexecutable files?
    6·1 answer
  • Which is an example of withholding you might see on your pay stub
    14·2 answers
  • ___ are files of related records organized according to logical systems and stored on computer-accessible media.
    5·1 answer
  • Which statement is true about the elements of the interface of a presentation program? The status bar appears at the top of the
    14·2 answers
  • NEED THIS NOW PLEASE!!!! (I AM NOT JOKING I HAVE TO SUBMIT IN 5 MINUTES)
    13·2 answers
  • Which of the following types of network can only be accessed by members within a private organization?
    5·1 answer
  • To print a mailing label, click the Labels button on the MAILINGS tab in the ____ group. A. Building Block B. AutoText C. Templa
    10·2 answers
  • A hacker uses a valid IP address of an internal host, and then from an external system, the hacker attempts to establish a commu
    11·1 answer
  • Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives
    5·2 answers
  • Which of the following keywords is used to remove a row in a table? (Points : 2) DROP
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!