Python Program to compute or calculate compound interest; Through this tutorial, i am going to show you how to calculate or compute compound interest in python.
Please look at the compound interest rate formula.
A = p * (pow((1 + r / 100), t))
A | = | final amount |
p | = | initial principal balance |
r | = | interest rate |
t | = | number of time periods elapsed |
Python Program to Calculate Compound Interest
- Python program to compute compound interest
- Python Program to Calculate Compound Interest using Function
Python program to compute compound interest
#Python program to compute compound interest p = float(input("Enter the principal amount : ")) t = float(input("Enter the number of years : ")) r = float(input("Enter the rate of interest : ")) #compute compound interest ci = p * (pow((1 + r / 100), t)) #print print("Compound interest : {}".format(ci))
Output
Enter the principal amount : 1000 Enter the number of years : 2 Enter the rate of interest : 5 Compound interest : 1102.5
Recommended:-Python Program to Calculate Simple Interest
Python Program to Calculate Compound Interest using Function
#Python program to compute compound interest using function def compoundInterest(p, r, t): ci = p * (pow((1 + r / 100), t)) return ci p = float(input("Enter the principal amount : ")) t = float(input("Enter the number of years : ")) r = float(input("Enter the rate of interest : ")) #call compound interest ci = compoundInterest(p, r, t) #print print("Compound interest : {}".format(ci))
Output
Enter the principal amount : 1000 Enter the number of years : 2 Enter the rate of interest : 5 Compound interest : 1102.5
Recommended Python Tutorials
Recommended:-Python Program to Add Two Numbers
Recommended:-Python Program to Find Average of n Numbers
Recommended:-Python String Methods/Functions
Recommended:-List methods in Python
Recommended:-Python Remove First & Last Character from String
Recommended:-Python Convert String Lowercase to Uppercase
Recommended:-Python Program to Convert Uppercase to Lowercase
Recommended:-Python Program Find Length of String
Recommended:-Python Concatenate String and Variable (int float)
Recommended:-Python Trim String – rstrip(), lstrip(), strip()
Recommended:-Python Dictionary Methods with Example
Recommended:-Python Reverse String
Recommended:-Python String find() Method
Recommended:-Python Replace Character in String
Recommended:-Python Convert String to Float
Recommended:-Python String translate() Method Example
Recommended:-Python Convert String to List
Recommended:-Python filter() Method
Recommended:-Python Map() Method
Be First to Comment