title: Why does calculating an interest rate in python with loop and formula differ?
body: <p>I'm currently designing a simple interest calculator but I am trying simple calculations where the results are similar but should be the same.</p>
  
  <p>For example:
  I start with 50 000$ and have a interest rate of 10% over the course of 5 years. The result with the classic formula looks like this: 50 000$ * 1,10^5 = 80 525,5$</p>
  
  <p>But with python i get the following result:</p>
  
  <pre><code>kapital_from_start = 50000.00
  intrest_rate_per_year = 10.00
  intrest_rate_per_month = (((intrest_rate_per_year / 12.0) / 100.0) + 1.0)
  additional_monthly_increase = 00.00
  duration_in_years = 5.0
  duration_in_months = duration_in_years * 12.0
  
  i = 1
  result = 0.0
  while i &lt;= duration_in_months:
      if i == 1: #First month.
          result = kapital_from_start * intrest_rate_per_month
      else:
          result *= intrest_rate_per_month
      i += 1
  
  print("\n\n######################################################\n")
  print("Resulting kapital: " + str(result) + " $.")
  print("\n######################################################\n\n")
  </code></pre>
  
  <p>I am getting the result: 82265,44673892925
  Which is give or take 82 300$ instead of 80 525,5$</p>
  
  <p>Does anyone know what is going on with these numbers? Why do they differ so much?
  If my calculations are correct, does that mean that actually looping trough these interest rates is more accurate than the formula which school books provide and banks have on their homepages for people to calculate their rates?</p>