How To Find Compound Interest In Python Program?

Python

Nicesnippets

75

15-07-2021


Hello Friends,

In this blog, I will show you how to calculate compound interest using python. I am going learn you python find compound interest example. We will talk about find compound interest in python.

This article will give you example of how to get compound interest in python. I would like share with you how to find compound interest program in Python: Here, we are going to learn how to find the compound interest in Python.

Here i will give you two example for how to calculate compound interest using python So let's see below example:


Formula

  • P is the principle amount
  • T is the time and
  • R is the rate
  • A is amount

amount = p * (pow((1 + r / 100), t))

ci = amount - p

Example 1 :

# Python program to find compound interest

p = input("Enter Principal: ")

t = input("Enter Time Period: ")

r = input("Enter Rate Of Interest: ")

# find compound interest

amount = p * (pow((1 + r / 100), t))

ci = amount - p

print('The Compound Interest is', ci)

Example 2 :

# Python program to find compound interest

def findCompoundInterest(p,t,r):

print('The principal is', p)

print('The time period is', t)

print('The rate of interest is',r)

# Calculates compound interest

amount = p * (pow((1 + r / 100), t))

ci = amount - p

print('The Compound Interest is', ci)

return ci

findCompoundInterest(8, 6, 8)

It will help you....