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

I just need to get one 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

  • Ziggurat@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    7 months ago

    Do you understand how compound interest work ? If yes write it down on a paper, and the code will flow. I don’t think we’ll be helping you on the long term by doing your homework.

  • mikyopii@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Do you have any code written? Generally speaking people are willing to help but won’t write your project for you.

  • Xavienth@lemmygrad.ml
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Interest is a repeating pattern. For repeating patterns, you use loops. With loops where the number of iterations is known as the start, you use a For-loop. Each iteration of the loop you can record the total.

    Google for loop python

  • Trent@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    7 months ago

    So how did you end up with an assignment like this while apparently knowing little if any python? This feels like someone signed up for a class, blew it off, and now suddenly has tests and stuff to turn in.

    • GulbuddinHekmatyar@lemmy.mlOP
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Well, I was trying to learn in g-10, at the start (when I was in-class, not online) , I had some previous computer classes before (I did Virtual Basics and Scratch, html even) but I didn’t do Python (and this is supposed to be an intro, regardless of previous experience) … wtf you expect me to do?

      Plus, why do you assume this of me?

    • GulbuddinHekmatyar@lemmy.mlOP
      link
      fedilink
      arrow-up
      0
      ·
      7 months 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}")