title: Combining multiple for loops in Python
body: <p>Let's say, we have and list of objects in variable called "articles", each object has a member "tags" (which is simple list).</p>
  
  <p>Expected output: all tags in all articles, joined in a single list.</p>
  
  <p>In multiple lines, solution would be:</p>
  
  <pre><code>arr = []
  for article in articles:
      for tag in article.tags:
         arr.append(tag)
  </code></pre>
  
  <p>Now, how can we write this in single line instead of 4?</p>
  
  <p>This syntax is invalid:</p>
  
  <pre><code>arr = [tag for tag in article.tags for article in articles]
  </code></pre>
  
  <p>Thanks!</p>