Member-only story
Create A Python Program For Compound Interest
Use Python To Calculate Compound Interest

Disclaimer: The material in this article is purely educational and should not be taken as professional investment advice. Invest at your own discretion.
According to investopedia, compound interest is the interest on a loan or deposit calculated based on both the initial principal and the accumulated interest from previous periods.
Essentially it is the interest that you get on your interest over some period of time. Compound interest is very important when it comes to finance, and Albert Einstein said it best.
“Compound interest is the most powerful force in the universe. He who understands it, earns it; he who doesn’t, pays it.”- Albert Einstein
So, in this article I will show you how to write a program using the python programming language to calculate compound interest !
Before we continue, if you enjoy my articles and content and would like more content on programming, stocks, finance, machine learning, etc. , then please give this article a few claps, it definitely helps out and I truly appreciate it ! So let’s begin !
Compound Interest Formula
In order to write this program, we must first know what the formula is for compound interest.
Formula:
A = P(1+R/100)^tA = Amount
P = Principle
R = Rate
t = time
The compound interest is the amount minus the principle amount.
Compound Interest = Amount - Principle
or
Compound Interest = A - P
Programming
First thing we will do is create and initialize our variables.
Principle = 5000 #$5,000 USD
Rate = 7.25 #7.25%
time = 10 #10 years
Next it’s time to use the formula.
#Formula => A = P(1+R/100)^t
Amount = Principle * (pow((1 + Rate / 100), time))
Last but not least we will calculate the compound interest and print it to the screen.
Compound_Interest = Amount - Principle…