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
In a blockchain, each block has a unique hash value which is dependent on the hash value of the previous block in the chain. Wha
pantera1 [17]

Answer: hello your question lacks the required option, below are the missing options

A. The transaction data in the tampered block is deleted, and a copy is created with the same hash value.

B. The hash values of transaction data of subsequent blocks are validated, and the chain is broken.

C. The hash value for the entire block is nullified, creating a domino effect on all subsequent blocks.

D. The hash values of subsequent blocks are updated as soon as they are tampered with, and the chain continues.

answer : The hash values of subsequent blocks are updated as soon as they are tampered with, and the chain continues ( D )

Explanation:

What happens if a transaction data is changed in an earlier existing block in a Blockchain is that the Hash values of subsequent blocks will be updated as soon as they are tampered with and the chain will continue.

Blockchain is a specially design system for recording information, hence any change in data inputted in an earlier existing blocks that changes will automatically be updated as well in all preceding blocks.

4 0
3 years ago
Sam has created a fashion website. There are many subscribers to his website. He has added new blogs, pictures, and articles abo
marusya05 [52]

Answer:

Post advertisements on social media and message the subscribers.

Explanation:

There is no point in not promoting and putting forward the work that he has been doing. All of the given options are about promoting the content but Sam needs to choose the ones which are efficient and seem professional as well.

Posting advertisements about the website promotes the content on a wider base and helps in luring more and more people to the website.

Messaging or sending an email to the subscribers is a healthy of letting the subscribers about the updates and latest posts.

8 0
3 years ago
Heeeeeeelp :)<br><br> hwjkwdlfo;pk
Rasek [7]

Answer: C u use schoology too :D

Explanation:

7 0
3 years ago
Which of the following is used to allocate memory for the instance variables of an object of a class?1. the reserved word public
kodGreya [7K]

Answer:

The correct answer to the following question will be 2. the operator new.

Explanation:

New operator is used to allocating the memory to the instance object.The new object can be created by using a "new" keyword in java .

Syntax of using 'new' operator is :

class_name object_name=new class_name() // it allocated the memory to the class

For Example :

ABC obj = new ABC;  

Now, this time obj points to the object of the ABC class.

obj = new ABC ();

call the construction of ABC class

3 0
3 years ago
What type of data causes concern for institutions are businesses Lincoln elected stored and not secured properly
Kobotan [32]

The type of data which causes concern for institutions or business when collected, stored, and not secured properly is Personal Identifying Information. The correct option is B.

<h3>What is personal identifying information?</h3>

A personal identifying information is the representation of data or information  of an individual that can be used to identify an individual specifically.

Some examples of a personal identifying information includes Social security number (SSN), E-mail address, Driver's license number. Bank account number, Full name and Passport number.

Business organizations should secure personal identifying information  properly, in order to avoid unauthorized access by hackers.

Thus, the correct option is B.

Learn more about personal identifying information.

brainly.com/question/4997276

#SPJ1

6 0
2 years ago
Other questions:
  • Which term is used to describe the science of examining raw data, removing excess noise from the dataset, and organizing the dat
    15·1 answer
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    14·2 answers
  • Write a short java method that takes an integer n and returns the sum of all the odd positive integers less than or equal to n.
    5·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • PLEASE HELP!<br> How do you "brainliest" an answer?
    13·2 answers
  • A(n) ____ is a front-end processor that multiplexes the traffic from hundreds of remote terminals into one port on a large compu
    10·1 answer
  • In the event you get pulled over for a traffic stop, describe the situation from the police officer's perspective and list at le
    6·2 answers
  • What framework provides a simple API for performing web tasks?
    13·1 answer
  • I'm showing my friends brainly. Answer with anything so they can see how fast I can get answers.
    10·2 answers
  • How are computers classified into different types? Explain ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!