Write a Python Program to Calculate Compound Interest

In this tutorial, we will discuss Write a Python Program to Calculate Compound Interest and this python program we are going to learn the concept of Calculate Compound Interest in the python language.

Python  Program to Calculate Compound Interest

Python Program to Calculate Compound Interest.

Let’s begin by writing a Python program to determine compound interest. In the below example, we have provided both future-value (the principal + interest accumulated) and the number of years as arguments.

let me show you the formula behind this Compound Interest:

Future CI = Principal Amount * ( 1 + ROI ) Number of years)

 

import math

princ_amount = float(input(" Please Enter the Principal Amount : "))
rate_of_int = float(input(" Please Enter the Rate Of Interest   : "))
time_period = float(input(" Please Enter Time period in Years   : "))

ci_future = princ_amount * (math.pow((1 + rate_of_int / 100), time_period)) 
compound_int = ci_future - princ_amount

print("Future Compound Interest for Principal Amount {0} = {1}".format(princ_amount, ci_future))
print("Compound Interest for Principal Amount {0} = {1}".format(princ_amount, compound_int))

 
Here the OutPut of this program.

Please Enter the Principal Amount : 600
 Please Enter the Rate Of Interest   : 5
 Please Enter Time period in Years   : 5
Future Compound Interest for Principal Amount 600.0 = 765.7689375000002
Compound Interest for Principal Amount 600.0 = 165.76893750000022

Leave a Comment

Verified by MonsterInsights