title: How do I update a single variable within a loop?
body: <p>What I'm trying to do in the while loop is iterate the payments by an integer of 10 so that if that integer (g) fails to get the <code>CBalance &lt;= 0</code> within a 12 months period then all of the variables reset except for g, which goes up by 1.</p>
  
  <pre><code>Balance = float(raw_input('Enter Balance '))
  Rate = float(raw_input('Enter interest rate '))
  monthlyI = Rate/12
  month = 0
  g = 1
  Payment = 10
  CBalance = Balance
  while CBalance &gt; 0:
      Payment = Payment*g
      month += 1
      CBalance = CBalance *(1+ monthlyI)- Payment
      if month &gt; 12:
          month = 0
          g += 1
          Cbalance = Balance
  </code></pre>