title: How to create a new array of consecutive elements without leaving the last element out?
body: <p>How do I create an array of consecutive words (1st position of the tuple elements) without leaving the last element out. </p>
  
  <p>For example I have a sample array</p>
  
  <pre><code>sample_array = [('do', 61), ('hello', 61), ('me', 61), ('me', 324), ('now', 61), ('now', 324), ('text', 3), ('you', 61), ('you', 3)]
  </code></pre>
  
  <p>Since there are 3 consecutive words, namely, 'me', 'now' and 'you', I want to output 3 arrays.</p>
  
  <pre class="lang-py prettyprint-override"><code>[('me', 61), ('me', 324)]
  [('now', 61), ('now', 324)]
  [('you', 61), ('you', 3)]
  </code></pre>
  
  <p>Here's my current code:</p>
  
  <pre class="lang-py prettyprint-override"><code>output = []
  for i in range(len(sample_array) -1):
      if sample_array[i][0] == sample_array[i+1][0]:
          output.append(sample_array[i])
      else:
          if output != []:
              output.append(sample_array[i])
              print(output)
              output = []
  </code></pre>
  
  <p>But its output is</p>
  
  <pre class="lang-py prettyprint-override"><code>[('me', 61), ('me', 324)]
  [('now', 61), ('now', 324)]
  </code></pre>
  
  <p>How do I include the elements with the word 'you'?</p>