title: python changing the value while doing average
body: <p>I'm currently getting an average value with a twist.  I'm averaging items but if I see a certain product name, I need to count that value as 3.  I can't make it work.  Below is my code and XML (shortened) file.  Basically if the loop see the Tofus, quantity should be overwritten with 3 and not 9..then get the average.</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  root = ET.ElementTree(file="nwind_medium.xml")
  
  orders = root.findall("./orders")
  quantityTotal = 0
  for order in orders:
      orderdetails = order.findall("./orderdetails")
      for detail in orderdetails:
          productName = detail.findall("./products/productname")
          quantityNew = detail.findall("./quantity")
          if productName[0].text == "chang" or productName[0].text == "chai" or productName[0].text == "Tofus":
              quantityNew = 3;
          else: 
              quantityTotal += float(quantityNew[0].text)
  numberQuantity = len(orders)
  </code></pre>
  
  <p>print "Average number of items an order is", round((quantityTotal / numberQuantity),1)</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  -&lt;nwind&gt; -&lt;orders another="Friday" orderid="10248"&gt; -&lt;customers&gt; &lt;companyname&gt;Vins et alcools Chevalier&lt;/companyname&gt; &lt;customerid&gt;VINET&lt;/customerid&gt; &lt;/customers&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;72&lt;/productid&gt; &lt;productname&gt;Mozzarella di Giovanni&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;34.8&lt;/unitprice&gt; &lt;quantity&gt;5&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;14&lt;/supplierid&gt; &lt;companyname&gt;Formaggi Fortini s.r.l.&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;11&lt;/productid&gt; &lt;productname&gt;Queso Cabrales&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;14&lt;/unitprice&gt; &lt;quantity&gt;12&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;5&lt;/supplierid&gt; &lt;companyname&gt;Cooperativa de Quesos 'Las Cabras'&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;42&lt;/productid&gt; &lt;productname&gt;Singaporean Hokkien Fried Mee&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;9.8&lt;/unitprice&gt; &lt;quantity&gt;10&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;20&lt;/supplierid&gt; &lt;companyname&gt;Leka Trading&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; &lt;/orders&gt; -&lt;orders orderid="10249"&gt; -&lt;customers&gt; &lt;companyname&gt;Toms Spezialitaten&lt;/companyname&gt; &lt;customerid&gt;TOMSP&lt;/customerid&gt; &lt;/customers&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;14&lt;/productid&gt; &lt;productname&gt;Tofus&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;18.6&lt;/unitprice&gt; &lt;quantity&gt;9&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;6&lt;/supplierid&gt; &lt;companyname&gt;Mayumi's&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;51&lt;/productid&gt; &lt;productname&gt;Manjimup Dried Apples&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;42.4&lt;/unitprice&gt; &lt;quantity&gt;40&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;24&lt;/supplierid&gt; &lt;companyname&gt;G'day, Mate&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; &lt;/orders&gt; -&lt;orders orderid="10250"&gt; -&lt;customers&gt; &lt;companyname&gt;Hanari Carnes&lt;/companyname&gt; &lt;customerid&gt;HANAR&lt;/customerid&gt; &lt;/customers&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;65&lt;/productid&gt; &lt;productname&gt;Louisiana Fiery Hot Pepper Sauce&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;16.8&lt;/unitprice&gt; &lt;quantity&gt;15&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;2&lt;/supplierid&gt; &lt;companyname&gt;New Orleans Cajun Delights&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;41&lt;/productid&gt; &lt;productname&gt;Jack's New England Clam Chowder&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;7.7&lt;/unitprice&gt; &lt;quantity&gt;10&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;19&lt;/supplierid&gt; &lt;companyname&gt;New England Seafood Cannery&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; -&lt;orderdetails&gt; -&lt;products&gt; &lt;productid&gt;51&lt;/productid&gt; &lt;productname&gt;Manjimup Dried Apples&lt;/productname&gt; &lt;/products&gt; &lt;unitprice&gt;42.4&lt;/unitprice&gt; &lt;quantity&gt;35&lt;/quantity&gt; -&lt;suppliers&gt; &lt;supplierid&gt;24&lt;/supplierid&gt; &lt;companyname&gt;G'day, Mate&lt;/companyname&gt; &lt;/suppliers&gt; &lt;/orderdetails&gt; &lt;/orders&gt; &lt;/nwind&gt;
  </code></pre>