Calculate Compound Interest using Python

Formula for compound interest :

A=final amount
P=initial principal balance
r=interest rate
n=number of times interest applied per time period
t=number of time periods elapsed
def compound_interest(principle, rate, time):
   CI = principle * (pow((1 + rate / 100), time))
   print("Compound interest : ", CI)

p=int(input("Enter Principal amount: "))
r=int(input("Enter interest rate: "))
t=int(input("Enter time period: "))
compound_interest(p, r, t)

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started