title: How can i access a jinja2 variable outside the for loop?
body: <p>im trying to use a for loop to add up some numbers for each day
  and i would like to access the variable outside the for loop  im not sure how to go about this   I am using the flask framework with python  and just come from weppy where this was not a problem  is there a way to make it work the same way in flask?</p>
  
  <p>here is some simple code </p>
  
  <pre><code>{% set newtotal = 0 %}
  {% for item in daily: %}
      {% set newtotal = newtotal + item[10]|float %}
  {% endfor %}
  
  &lt;div class="bottom"&gt;
      &lt;span&gt;Total: {{ newtotal }}&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>the numbers collected by item[10] are dollar values
  if i place the <code>{{ newtotal }}</code> before the endfor it shows every value as its being added up this is not what I want</p>
  
  <p><strong>EDIT</strong>:
  if it helps daily is a list of 8 tuples</p>