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
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.
Well, ok, from memory
Correct me if I’m wonrg…
Do you have any code written? Generally speaking people are willing to help but won’t write your project for you.
Uh I had to copy admittedly from Bro Code but here…
https://replit.com/@354075897/CompoundInterest#main.py
It’s basic but understandable and functions as usual… the thing is I need to show progress over time…
So what does it do wrong? or what do you need actual help with? What have you tried?
I need to show the sum increasing over time… just look at my example in my post over there, ight…
I took the code you posted and then asked the free version of ChatGPT to do what you asked and got working code immediately. I would go that route.
This works if you just want to finish the assignment but not actually learn anything.
To be teen again and don’t know how to ask for help on the internet.
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
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.
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?
def calculator(initial, rate, years): Return initial *(1 + rate/100)**years
Calculator(600, 5, 2)
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}")
What’s your question?
Do your own homework!