title: How to simplify a for loop in a for loop and an if statement?
body: <p>Can I shorten this code into 1-2 lines?</p>
  
  <p>I've tried making it into a list comprehension but I'm not sure how it would work if one of the for loops uses a dictionary key. </p>
  
  <pre><code>for a in dict.keys():  
      for q in list:  
          if a in q:  
              dict[a].append(q)  
  </code></pre>
  
  <p>This code works well to find if the items in the list are one of the dictionary's keys and stores the item as a value under that dictionary key if it is, but I'm hoping to figure out if I can simplify it more. </p>