title: Using a loop to check if a value has changed?
body: <p>I'm totally new to programming, please bear with me. I have a question regarding loops and how to detect changes. My list for example is:</p>
  
  <pre><code>['09/2004', 297294186.0]
  ['09/2004', 257905788.0]
  ['09/2004', 768116019.0]
  ['09/2004', 458513425.0]
  ['08/2004', 251973518.0]
  ['08/2004', 265328010.0]
  ['08/2004', 330020350.0]
  ['08/2004', 383188410.0]
  ['08/2004', 487483400.0]
  ['08/2004', 800294431.0]
  ['08/2004', 999609680.0]
  ['08/2004', 1237831666.0]
  ['08/2004', 2242789646.0]
  </code></pre>
  
  <p>And I want to find the average for each month. I know how to find that but the only way I can think of doing it is</p>
  
  <pre><code>for i in list:
   if month == '08'
      do average
  
      if month =='09'
      do average
  
      if month == '10'
      do average
  </code></pre>
  
  <p>Is there any way I can do a loop that automatically detects when the month has changed, do the average for that month, and continue automatically, instead of doing a ton of if commands?</p>
  
  <p>Any help is much appreciated</p>
  
  <p>William</p>