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
daser333 [38]
4 years ago
8

The function below takes two arguments, a dictionary called dog_dictionary and a list of dog names (strings) adopted_dog_names.

The dog dictionary uses dogs' names as the keys for the dictionary. Complete the function to remove all the adopted dogs from the dog_dictionary. Return the dictionary at the end of the function.
Computers and Technology
1 answer:
laiz [17]4 years ago
4 0

Answer:

The solution code is written in Python.

  1. def removeAdoptedDog(dog_dictionary, adopted_dog_names):
  2.    for x in adopted_dog_names:
  3.        del dog_dictionary[x]
  4.    
  5.    return dog_dictionary  
  6. dog_dictionary = {
  7.    "Charlie": "Male",
  8.    "Max" : "Male",
  9.    "Bella" : "Female",
  10.    "Ruby": "Female",
  11.    "Toby": "Male",
  12.    "Coco": "Female",
  13.    "Teddy": "Male"
  14. }
  15. print(dog_dictionary)
  16. adopted_dog_names = {"Ruby", "Teddy"}
  17. print(removeAdoptedDog(dog_dictionary, adopted_dog_names))

Explanation:

Firstly, let's create a function <em>removeAdoptedDog() </em>takes two arguments, <em>dog_dictionary </em>& <em>adopted_dog_names</em> (Line 1)

Within the function, we can use a for-loop to traverse through the <em>adopted_dog_names</em> list and use the individual dog name as the key to remove the adopted dog from <em>dog_dictionary </em>(Line 3). To remove a key from a dictionary, we can use the keyword del.

Next return the updated dog_dictionary (Line 5).

Let's test our function by simply putting some sample records on the <em>dog_dictionary</em> (Line 7 -15)  and two dog names to the <em>adopted_dog_names list</em> (Line 19).

Call the function <em>removeAdoptedDog() </em>by<em> </em>passing the <em>dog_dictionary and adopted_dog_names </em>as arguments. The display result will show the key represented by the<em> adopted_dog_names</em> have been removed from the <em>dog_dictionary </em>(Line 21).

You might be interested in
In this unit, you learned how to manipulate numbers and strings, acquire input from the user, perform data manipulations for var
e-lub [12.9K]

Answer:

Sometimes you will tell the CPU to use the main memory, secondary memory, network, or the input/output devices. Digital Computing: It's All ...

4 0
3 years ago
Suppose you define a java class as follows: public class test { } in order to compile this program, the source code should be st
likoan [24]
Test.java

The classname and the filename need to match (case sensitive).
5 0
3 years ago
Other than technology and start-up costs what are two
sattari [20]
The other two particular cases of hindrances that could keep an organization or individual from entering a market are the beneath: 
Individual attributes - there are sure occupations that specific criminals are not permitted to do - sex wrongdoers can't start up youngster mind offices; individuals with associations with composed wrongdoing shouldn't have the capacity to begin gambling clubs, and so on. There are employments that outsiders can't do. Furthermore, for a few employments, you require unique trusted status. 
Local legal restricti - you can't simply begin a taxicab organization in New York, you need to have emblems for your taxis. It is practically difficult to get one from the city, so you regularly need to purchase another person out
6 0
3 years ago
Fill in the blank: A keyword set to _____ match type will display your ad if the search term contains the same order of the word
jekas [21]

A keyword set to <u>Algorithm's</u> match type will display your ad if the search term contains the same order of the words, but it can also contain additional words. Negative phrase broad specific

<h3>What is Algorithms?</h3>

Algorithms, which are sequences of actions linked together to accomplish a task, operate in this direction – their goal is to give internet users this very specific information.

With this information, we can conclude which algorithm is the tool used to obtain specific information and make it available to the user.

Learn more about Internet in brainly.com/question/18543195

3 0
3 years ago
Deb needs to add borders on the cells and around the table she has inserted into her Word document.
slavikrds [6]

Answer:

Design tab

Explanation:

  1. Select the call or table that you will like to use
  2. Then select the <em>design tab</em>
  3. In the group <em>page background</em> select <em>Page Borders</em>
  4. There you will have multiple choses for where you want your border
  5. You can even customize your border by pressing <em>Custom Border </em>at the bottom of the list for <em>Page Borders</em>
4 0
3 years ago
Read 2 more answers
Other questions:
  • When measuring an unknown voltage with an analog VOM, you should first A. ground the circuit. B. set the switch to the lowest ra
    5·1 answer
  • You are attempting to gather information about a client's network, and are surveying a company site. Access is gained via secure
    8·1 answer
  • This program has some errors in it that are needed to be checked import java.io.*;
    13·1 answer
  • During project management, who executes tasks and produces the deliverables as stated in the project plan and as directed by the
    9·1 answer
  • String[][] arr = {{"Hello,", "Hi,", "Hey,"}, {"it's", "it is", "it really is"}, {"nice", "great", "a pleasure"},
    11·1 answer
  • The process where the programmer steps through each of the program's statements one by one is called
    11·1 answer
  • JUST MAXED OUT THE COMMENTS anyways come here
    7·2 answers
  • Normalization works through a series of stages called normal forms. For most purposes in business database design, _____ stages
    7·2 answers
  • I will make you brainless Just answer this question!!
    9·1 answer
  • Why do my airpods keep disconnecting from my laptop
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!