Merging the 2 lists into 1 which are values in a Dictionary
<p>Hello all I am very new to the programming.</p>

<p>I have a dictC</p>

<p>dictC = {'a':[1,2,3,4,5],'b':[5,6,7,8,9,10]}</p>

<p>I want my output like </p>

<p>mergedlist = [1,2,3,4,5,6,7,8,9,10]</p>

<p>Could any one help me with the logic to define a function?</p>

<p>I have tried some thing like this </p>

<p>enter code here
dictC = {'a': [1, 2, 3, 4, 5, 6, 7], 'b': [3, 7, 8, 9, 10]}</p>

<pre><code>result = MergeDictValues(dictC)

print result
</code></pre>

<p>dictC = {'a': [1, 2, 3, 4, 5, 6, 7], 'b': [3, 7, 8, 9, 10]}
    dictc= (dictC.values())</p>

<pre><code>dictc.extend(dictc)

print dictc
</code></pre>

<p>def MergeDictValues(inputDict):
    resultList = []
    mergedList = # I am missing my logic here 
    mergedList.extend( )
return resultList()</p>

<pre><code>MergeDictValues(dictc)

resultList= MergeDictValues(dictc)

print resultList
</code></pre>

<pre><code>def MergeDictValues(dictC):
    return [x for y in dictC.values() for x in y]
</code></pre>

<p>Input :</p>

<pre><code>dictC = {'a':[1,2,3,4,5],'b':[5,6,7,8,9,10]}
MergeDictValues(dictC)
</code></pre>

<p>Out put :</p>

<pre><code>[1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10]
</code></pre>

python python-2.7 python-3.x