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]
3 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]3 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
What feature should you enable to prevent the sidhistory attribute from being used to falsely gain administrative privileges in
Katarina [22]

SID filtering enables to control of the sid history attribute from being utilized to falsely gain administrative privileges in a trusting forest.

<h3>What is  SID filtering?</h3>

SID filtering renders the domain controllers (DCs) in a trusting domain to remove all SIDs that aren't members of the trusted domain. In other words, if a user in a trusted domain exists as a member of groups in other domains in the forest, the trusting domain will withdraw those groups' SIDs from the user's access token.

For a newly set up trust between two domains or two forests, the SID Filtering exists activated by default. The filter extracts all foreign SIDs from the user's Access Token while accessing a resource through trust in a trusting domain.

SID filtering enables to control of the sidhistory attribute from being utilized to falsely gain administrative privileges in a trusting forest.

To learn more about SID filtering refer to:

brainly.com/question/23814085

#SPJ4

3 0
2 years ago
What is the age group for the silent genration
Maurinko [17]
21 years old. If you take 1944-1923 you get 21 because that would be ho wold they are
7 0
3 years ago
What is a wiki farm?
bagirrra123 [75]

A wiki hosting service or wiki farm is a server or an array of servers that offer users tools to simplify the creation and development of individual, independent wikis.

4 0
3 years ago
Read the paragraph.
aleksandrvk [35]

Answer:

I think sentence 3 bc it doesn't really make any sense Ik it's explaining it but it doesnt connect with the whole story as much I think it has to have more details

5 0
3 years ago
Read 2 more answers
A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser.
FrozenT [24]
That is false. are you doing it on a computer course.                                             <span />
3 0
3 years ago
Read 2 more answers
Other questions:
  • Liz will use a CD-R compact disk to write to more than once. Carlo will use a CD-RW compact disk to write to more than once. Who
    8·2 answers
  • Which option in Outlook allows a user to look at multiple calendars in a side-by-side fashion?
    14·2 answers
  • You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
    10·1 answer
  • When you call a ____________ method, it executes statements it contains and then returns a value back to the program statement t
    6·2 answers
  • Which printer are used to print text and graphics with high speed ​
    15·1 answer
  • Please select the word from the list that best fits the definition Asking for review material for a test
    14·2 answers
  • What is the value of the variable result after these lines of code are executed? &gt;&gt;&gt; a = 5 &gt;&gt;&gt; b = 2 &gt;&gt;&
    8·2 answers
  • Which of the following component is required to insert text in multimedia
    8·1 answer
  • Which of the following helps you plan out every step of an animation?
    12·2 answers
  • 5. What skill is unique to reading online?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!