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
Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
Anna71 [15]

Answer:

a)   Consider sequence numbers,First segment=90

Second segment=110

Data in the first segment = 110-90  =20

b) Consider the first segment is lost but the second segment arrives at B. In the acknowledgment that Host B sends to Host A, then the acknowledgment number will be first segment of sequence number, that is 90.

Explanation:

8 0
4 years ago
Read 2 more answers
Which of the following techniques has to do with how the people who make the commercial manipulate the way it looks?
marta [7]
<span>a. Omission
_________
</span>
6 0
4 years ago
How was the Big Ben project similar to the investigation you conducted in class to determine if the table was vibrating? How is
a_sh-v [17]

Answer:

Mate it has been about two months

Explanation:

3 0
3 years ago
PAGE<br>DATE<br>0 What types of information should be there internet?​
Hoochie [10]

Answer:

The kind of information that should be on the internet must be one that is good.

Explanation:

Qualities of good information are as follows:

A) Relevance:

For the purpose it was published, to the audience, it was intended for, every information put out there on the internet must be relevant. This is key and not negotiable. Perhaps its relevance may wane over time, however, in the period it was posted, it has to speak to the intended purpose.

B) Complete:

Incomplete information automatically becomes misleading or useless.

To say Donald Trump was a United States president in 2021 would be factually correct. However, that statement is misleading because he also stepped down in the same year for Joe Biden. Now that gives a complete and true picture of the Presidency of the United State of America (POTUS) in 2021.

 

C) Accuracy:

Accuracy means there is little chance for misinterpretation, misinformation, and misrepresentation of facts.

Essentially, if it's a spade, don't call it a pen.

D) Clarity:  

"In 2020, delegates to the White House to speak about the problems so that we can be happy so the problems have to go away soon"

The above statement at its best only tells us that someone sent delegates to the White House to speak about problems. We don't know what the problem was, who the delegates were, nor do we know who sent them. Clarity is key. The next point conciseness also helps with this.

E) Conciseness

Another word for this is brevity.

This does not necessarily mean one must only publish short messages on the internet. It simply means that you must make your point with the least amount of words possible.

F) Authenticity

Call it trustworthy information if you like. People make decisions based on information they have received. If one must put out information on the internet, it must be true, factual, and correct.

Cheers

5 0
3 years ago
What does a closed-envelope icon next to an e-mail message header indicate?\?
Fynjy0 [20]
That it was unread that’s what mine means
7 0
4 years ago
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • What is the name of google's mobile operating system, used on smartphones and tablets from many manufacturers?
    6·1 answer
  • Which of the following is a bad password? Select one: a. The acronym for the title of your favorite song plus the year it came o
    11·1 answer
  • Moving your Sprite from right to left is considered the X coordinate?
    5·1 answer
  • Does nature behave the exact same way as fractals?
    15·1 answer
  • This isn't academic, but what do I do if HI-REZ won't let me sign into an existing account. “Something went wrong” keeps popping
    5·1 answer
  • Brainliest For Tascake Because People Texted Before Tascake Could<br><br> Hurry Tascake
    13·2 answers
  • List resource you can utilize if you are experiencing technology issued
    5·1 answer
  • 1. A cell is identified by its ........
    8·1 answer
  • An Accenture healthcare client is interested in implementing an Artificial Intelligence (AI) solution to improve patient care, b
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!