In this article, we will learn about the solution and approach to solve the given problem statement.
Problem statement −We are given with three input values i.e principle, rate & time and we need to compute compound interest.
The code given below shows the process of computation of compound interest.
The formula used here is
Compound Interest = P(1 + R/100)r
P is the principal amount
R is the rate and
T is the time span
The implementation is given below
def compound_interest(principle, rate, time): CI = principle * (pow((1 + rate / 100), time)) print("Compound interest : ", CI) # main compound_interest(10000, 7.78, 2)
Compound interest : 11616.528400000001
All variables and functions are declared in global scope as shown in the figure below.
In this article, we learned about the approach to compute compound interest.