Question: I have two dictionaries as follows:

`D1={'a':1,'b':2,'c':3}`

and 

`D2={'b':2,'c':3,'d':1}`

I want to merge these two dictionaries and the result should be as follows:

`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`

how can I achieve this in python?

Answer: 
You may want to try:

```
D3 = {}
D3.update(D1)
D3.update(D2)

```

Here, we're creating an empty dictionary `D3` first, then update it from the two other dictionaries.

Note that you need to be careful with the order of the updates: if `D2` shares some keys with `D1`, the code above will overwrite the corresponding entries of `D1` with those of `D2`.

Note as well that the keys will **not** be repeated. The example you give `D3={a:1,b:2,c:3,b:2,c:3,d:1}` is not a valid dictionary.
What are you asking is not possible, since you cannot have two different keys with the same value in a Python dictionary.

The closest answer to your question is:

`D3 = dict( D1.items() + D2.items() )`

Note: if you have different values for the same key, the ones from D2 will be the ones in D3. 

Example:  

`D1 = { 'a':1, 'b'=2 }`  

`D2 = { 'c':3, 'b':3}`  

Then, D3 will be:  

`D3= { 'a':1, 'b':3, 'c':3 }`