title: The variable XXXX is undefined
body: <p>I'm try to find the biggest value and corresponding key in a dict <code>totals</code>, when I code like this, I can get the right answer:</p>
  
  <pre><code>highest_value = 0
  highest_key = None
  for a_country in totals.keys():
      if totals[a_country] &gt; highest_value:
          highest_value = totals[a_country]
          highest_key = a_country  
  </code></pre>
  
  <hr>
  
  <p>while I use another way, an error "<strong>The variable highest_key is undefined.</strong>". </p>
  
  <pre><code>highest_value = 0
  highest_key = None
  for a_country in totals.keys():
          highest_value = totals[a_country] if totals[a_country] &gt; highest_value else highest_value 
          highest_key = a_country if totals[a_country] &gt; highest_value else highest_key 
  </code></pre>
  
  <p>I'm confused... I think the two codes are the same ....</p>