In this article, we will show you, How write a Python program to Calculate Compound Interest with example. Before we start the example, let me show you the formula behind this Compound Interest:

Future Compound Interest = Principal Amount * ( 1 + Rate of Interest ) ^{Number of years})

Above calculation is called as Future Compound Interest, because it contains both Principal Amount & Compound Interest. To get Compound Interest use below formula:

Compound Interest = Future Compound Interest – Principal Amount

## Python Program to Calculate Compound Interest

This python program allows user to enter Principal Amount, Rate of Interest, and time period (Number of years). Using those values, it will calculate compound Interest using the above specified formula.

# Python Program to find Compound Interest 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))

**OUTPUT**