![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Program for compound interest
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
Where,
P is the principal amount
R is the rate and
T is the time span
The implementation is given below
Example
def compound_interest(principle, rate, time): CI = principle * (pow((1 + rate / 100), time)) print("Compound interest : ", CI) # main compound_interest(10000, 7.78, 2)
Output
Compound interest : 11616.528400000001
All variables and functions are declared in global scope as shown in the figure below.
Conclusion
In this article, we learned about the approach to compute compound interest.
Advertisements