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
Crazy boy [7]
3 years ago
5

Write a Python function merge_dict that takes two dictionaries(d1, d2) as parameters, and returns a modified dictionary(d1) cons

tructed using the following rules. The rules for addition into the new dictionary are as follows: Add key/value pairs from d2 into d1. If a key from d2 already appears in d1: the new value in d1 is the sum of the values If a key appears only in d1 or d2, then the new value in d1 is the original value from the dictionary that contained this key. Finally, return d1
Computers and Technology
1 answer:
OLga [1]3 years ago
7 0

Answer:

# We define the function merg_dict with the two dictionaries d1 and d2 that it #will take.

def merge_dict(d1,d2):

      for key in d2:

               if key in d1:

                   d1[key] = d1[key] + d2[key]

               else:

                   d1[key] = d2[key]  

          return d1

# We define the parameters of the dictionary d1 and d2

d1 = {'a': [1, 2, 3], 'b': [2, 2, 2], 'c': [1,2,3]}

d2 = {'a': [4,4,4], 'c': [3,3,3]}

#Next we call on the function merge_dict

print(merge_dict(d1,d2)

We'll obtain the following as output:

{'a': [1,2,3,4,4,4], 'b': [2,2,2], 'c': [1,2,3,3,3,3]}

You might be interested in
Fill in the blank to complete the sentence. -------------------- is used to store and process data over the Internet using compu
Trava [24]

Answer:cloud computing

Explanation:

6 0
3 years ago
A technician would like to have the ability to add physical hard drives to a Storage Spaces storage pool at future times on an a
Iteru [2.4K]

Answer:

b. Thin provisioning

Explanation:

Thin provisioning is a storage space feature that makes allocating disk storage space flexible based on the space needed by each user, it improves the way storage space is utilized.

5 0
3 years ago
To turn off the AutoCorrect features, navigate to the AutoCorrect menu and deselect the box labeled_____.
barxatty [35]
Option A-Show AutoCorrect buttons, then you have the options to hide the autocorrect or to turn it on/off
4 0
3 years ago
Read 2 more answers
Which is an advantage of using a flat file instead of a relational database?
ioda

Answer:

The answer to this question is given below is the explanation section.

Explanation:

"A flat file is easier to set up" This option is correct

The advantages we will examine is a flat file is easier to setup.A flat file system can be viewed from any number of application making is very accessible. user will also have very little difficult with understanding the data because each record contains all available about a given flight.simple queries and storing should be no problems for most flat file based systems.

5 0
3 years ago
The primary objective of database design is what?
professor190 [17]

Answer:

D)

Explanation:

4 0
3 years ago
Other questions:
  • Unwanted or unneeded software included by manufacturers on new computers is called
    9·1 answer
  • How do Web browsers interact with URL/URIs to navigate the internet
    14·1 answer
  • The main circuit board of a computer is the _______. The ______ is located on the circuit board. The _____ is the circuitry that
    14·1 answer
  • Your company shares a building with a competitor’s branch office. Recently, you noticed that some computers other than company c
    7·1 answer
  • blank protects equipment from too much current by tripping a switch that breaks the circuit, stopping the flow of electricity
    7·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    15·2 answers
  • A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AN
    9·1 answer
  • Who is the host in super monkey ball?
    14·1 answer
  • Image editors edit images consisting of thousands of pixels that form this type of image.
    13·2 answers
  • Which of the following terms refers to the cells that contain values and labels to be graphed in the chart?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!