Directory Math Error with [i]
<p>I was working on a simple math solver, and I created a directory where the user's inputs would store:</p>

<pre><code>data = {
       'name': {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: ''},      
       'quantity': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'soldin': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'price': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'yld': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'apc': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'epc': {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1}, 
       'exc': {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0}
       }
</code></pre>

<p>I also had the code which would solve the problem in question (the i is set within the program based on how many data sets the user inputted):</p>

<pre><code>i = 2
while(i &gt;=0):
   first = data['soldin'][i]
   second = data['price'][i]
   apco = float(data[first][i])/float(doug)
   epco = apco/data['yld'][i]
   i = i - i
</code></pre>

<p>However, it gives the following error:</p>

<pre><code>Traceback (most recent call last):
  File "python", line 31, in &lt;module&gt;
KeyError: 0
</code></pre>