title: how to create a dictionary having different number of values at different keys?
body: <p><strong>Question.1 )</strong> I want to create a dictionary , it consist of 8 keys , some keys has 2 values and some keys have 3 values. how to create this kinda dictionary in python.</p>
  <p>i been trying using nested loops , but my logic  didn't worked.</p>
  <p><strong>Desired output</strong></p>
  <pre><code>dict_a = { 1:[0,1], 2:[2,3], 3:[4,5], 4:[6,7], 5:[8,9], 6:[10,11], 7:[12,13,14], 8:[15,16,17] }
  
  </code></pre>
  <p><strong>Question.2 )</strong> If we successfully create the <code>dict_a</code> then,  In the second part, i want to merge the multiple values of dict_a according to the dict_b,shown below.</p>
  <p><strong>for example :-</strong>  In <code>dict_b = { 1:[1,2], 2:[2,3]......}</code> ,Here <code>1:[1,2]</code> means  I want to merge 1st and 2nd 'values' of dict_a dictionary, which will give me <code>[0, 1, 2, 3]</code>. similarly <code>2:[2,3]</code> will give me <code>[2,3,4,5]</code></p>
  <pre><code>dict_b = { 1:[1,2], 2:[2,3], 3:[3,4], 4:[4,5], 5:[5,6], 6:[6,7], 7:[7,8] }
  
  </code></pre>
  <p>I actually tried the above method successfully, but for two keys <code>7th</code>and <code>8th</code> in <code>dict_a</code> , i want to merge with first two values only, i.e when <code>dict_b</code> goes to it's 7th key <code>7:[7,8]</code>, i want the result to be <code>[12,13,15,16]</code> and not <code>[12,13,14,15,16,17].</code></p>
  <p>but the method i used below will merge all inevitably.</p>
  <pre><code>
  dict_a = { 1:[0,1], 2:[2,3], 3:[4,5], 4:[6,7], 5:[8,9], 6:[10,11], 7:[12,13,14], 8:[15,16,17] }
  
  dict_b = { 1:[1,2], 2:[2,3], 3:[3,4], 4:[4,5], 5:[5,6], 6:[6,7], 7:[7,8] }
  
  a_list = []
  
  for i in dict_b:
      tem = []
      a_list.append(tem)
      for j in dict_b[i]:
          tem.extend(dict_a[j])
      print(tem)        
  </code></pre>
  <p><strong>Desired output-</strong></p>
  <pre><code>[0, 1, 2, 3]
  [2, 3, 4, 5]
  [4, 5, 6, 7]
  [6, 7, 8, 9]
  [8, 9, 10, 11]
  [10, 11, 12, 13]
  [12, 13, 15, 16]
  </code></pre>