title: How to write recursive function properly?
body: <p>Im new to Python and therefore apologize if the question ist to basic:</p>
  
  <p>I would like to write a function which calculates the minimum monthly payment needed in order pay off a credit card balance within 12 months using recursion.</p>
  
  <p>Given the following:</p>
  
  <pre><code>initialBalance = 1000 # Thats my initial balance on card / debt
  annualInterest = .2
  startPeriod = 1 # when I start to begin my pament
  minMonthPayment = 5 # I begin a monthly payment of 5 $
  
  def repayment(initialBalance,annualInterest,minMonthPayment,startPeriod):
  
      while startPeriod &lt; 12 and initialBalance &gt; 0:
          monthRate = annualInterest/12
          interest = monthRate * initialBalance
          initialBalance -= minMonthPayment
          initialBalance += interest
          startPeriod += 1
          # Here I check if I still havent paid off the balance with initial 5 dollars
          # If not then I would like to call the function again and increase the minMonthPayment 
      if initialBalance &gt; 0:
          repayment(initialBalance,
                    annualInterest,
                    minMonthPayment + 5,
                    startPeriod)
      return round(initialBalance,1)
  
  print(repayment(1000,.2,5,1))  
  </code></pre>
  
  <p>However that doesnt seem to call the function appropriately and return:</p>
  
  <pre><code>RecursionError: maximum recursion depth exceeded in comparison
  </code></pre>