Compound and Simple Interest Calculation using Python
In this tutorial, we are going to write a Python program to calculate compound and simple interest using Python program. I hope you have also done the math related to interest when you were in high school.
Below is given a list that shows exactly what we will do:
- The user inputs the Principle Value.
- Then, the user inputs the rate of interest in percentage.
- In the third line, the user inputs the time interval.
- Then, the user must input the compounding frequency.
- The output shows the Future Value and the Interest paid.
The image below shows the formula for Compound Interest Calculation:

COMPOUND INTEREST CALCULATION
The below is of Simple Interest Calculation formula:
A = P(1 + rt) Where A is the total amount P is for principal amount Interest amount is I here r is known as rate of interest t is the time period.
Special note: r is for the rate of interest in decimal and r= R/100 where R is the interest rate in percentage.
Why Compound Interest is Important?
- Let’s say that an investment is by you in an asset that returns, on average, 7% each year, and let’s say you invest Rs. 10,000 as Principle Value in the first year.
- One year later, you get Rs. 10,000 of your original investment, and Rs. 700 of growth.
- In the second year, you now have Rs.11,449 (Rs.10,700 + Rs.10,700 * 7%)
- Over 40 years, the growth is quite large: your Principal Value of Rs.10,000 investment is worth Rs.1,49,745!
- 1 year later, you barely find any difference between your original investment and the final value. But after 30 years, you had over 7 times your principal investment! That’s the power of compounding.
- Let’s take a look at the code snippet and its output.
How Simple Interest is different from Compound Interest?
- First, simple interest is the calculation of that interest which ignores the compounding effect.
- Second, simple interest doesn’t compound with each time period of a loan.
- Third, simple interest is advantageous for borrowers whereas compound interest is advantageous for lenders.
Python program to find out the compound and simple interest rate
PROGRAM:
P=int(input("Input Principle Value: "))
R=int(input("Input Rate of Interest: "))
T=int(input("The Time Interval for which investment is done: "))
n=int(input("The Compound Frequency:"))
R/=100
R=round(R,2)
F1=P*((1+R/n)**(n*T))
I1=F1-P
I1=round(I1,2)
F1=round(F1,2)
I2=P*R*T
F2=P+I2
print("In Compound Method:")
print(" Compound Interest:",I1)
print(" Future Value:",F1)
print("In Simple Method:")
print(" Simple Interest:",I2)
print(" Future Value:",F2)OUTPUT 1:
Input Principle Value: 60000
Input Rate of Interest: 8
The Time Interval for which investment is done: 15
The Compound Frequency:2
In Compound Method:
Compound Interest: 134603.85
Future Value: 194603.85
In Simple Method:
Simple Interest: 72000.0
Future Value: 132000.0
OUTPUT 2:
Below is another output example with a different amount of investment:
Input Principle Value: 70000
Input Rate of Interest: 8.5
The Time Interval for which investment is done: 15
The Compound Frequency:2
In Compound Method:
Compound Interest: 192172.27
Future Value: 262172.27
In Simple Method:
Simple Interest: 94500.0
Future Value: 164500.0
Also Read:
Leave a Reply