Pardon me if this isn’t the right place to ask but I need to make a compound-interest calculator, as a small high school project… with the feature that will help show the increase of investment over time

I just need to get the first part over with it…

Savings Simulator

Enter you initial investment: 600.00

Let’s invest your money

Interest Rate: 5

Number of years: 2

Year 1 $630.00

Year 2 $661.50…

https://docs.google.com/document/d/1Cebi50BQlEwuRnMG79TDZ178CHWMDTNIxN82b1xdASc/edit

    • GulbuddinHekmatyar@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Thanks, but my project requires also the results between the first and the last year the investment was increased…

      As a base, I’m testing $600, 5% interest, and 6 years to wait, so I need to show the amount for years 1-5 as output, before I see final result of the 6th year…

      I can’t just put:

      total1 = principle * pow((1 + rate/100), 1)

      print(f"Balance after {1} year/s: ${total1:.2f}")

      total2 = principle * pow((1 + rate/100), 2)

      print(f"Balance after {2} year/s: ${total2:.2f}")

      total3 = principle * pow((1 + rate/100), 3)

      print(f"Balance after {3} year/s: ${total3:.2f}")