title: How to create nested list according to value in the list?
body: <p>I have 2 lists, that I would like to use to create a nested list:</p>
  
  <pre><code>list1=['a','a','b','c','d','d']
  list2=['a1','a2','b','c','d1','d2']
  
  result = [['a1','a2'],['b'],['c'],['d1','d2']]
  </code></pre>
  
  <p>meaning that I want to create one sublist per item from list1 (eg. here 4 lists, one for a, one for b, one for c, and last one for d); and the list "result" storing the values from list2. I never did something like that until now, I've read about comprehension lists, but I don't know how to use them.</p>