title: Using a for loop to compare if current value is less than previous
body: <p><strong>Background:</strong></p>
  
  <p>I'm utilizing 2 dictionaries. For my purposes, the first governor_db is a dictionary contains a governor's name as the key and the values are just sets of information that go with it like the year they served etc. The second is a dictionary that contains the year as the key and the values are the unemployment for each month of that year (the key).</p>
  
  <p><strong>What I'm currently working on:</strong></p>
  
  <p>The function I'm working on calls a previous function I used to calculate the average unemployment per governor during the years they served. What I have (below) is iterating through the name of the governor and pulling the average unemployment into this new function to be able to compare what the lowest average unemployment is and who the governor was with that piece of information.  </p>
  
  <p>So far what I have will either iterate through it and give me the lowest unemployment accurately , but won't give the right governor that goes with that lowest value. </p>
  
  <p><strong>My current code:</strong></p>
  
  <pre><code>def governor_lowest_avg_unemployment(g_db,unemployment_db):
      all_unemploy={}
      for  governor in g_db.keys():
          avg_unemploy= avg_unemployment_for_governor(g_db,unemployment_db, governor)
          if avg_unemploy==None:
              all_unemploy[governor]=0
          else: 
              all_unemploy[state]= avg_unemploy
      lowest_avg= min(all_unemploy.values())
      for key, value in all_unemploy.items():
          if value == lowest_avg:
              lowest_gov= key,value
      return(lowest_gov)
  </code></pre>
  
  <p>What I want to try to do, is as I'm iterating through that dictionary and it's corresponding unemployment value (stored in dictionary all_unemploy above), I want to be able to store the previous value and compare if the new value I am iterating through is smaller than the previous one. If the new value is smaller than the previous, I want to replace the previous one with the new one and go one until it stops iterating through the dictionary and give me the right tuple combination of lowest avg of : (Governor, average unemployment) </p>
  
  <p>Idea I started was to do something like the following. I'm not sure how to implement it though:</p>
  
  <pre><code>for key, value in all_unemploy:
      if value&gt; previous
          pass
      elif value == previous
          pass
      elif value = None
          pass
      elif value &lt; previous
          lowest = key, value
  return lowest
  </code></pre>
  
  <p>None in this case just means that for the previous function, there wasn't enough information in the unemployment database to calculate that governor's average unemployment rate.</p>
  
  <p>How would I be able to compare the values like so, and end up getting an accurate lowest value ? Am I on the right track with my idea of implementing such a thing? </p>