Simple Interest in Python
Overview
This article covers the method for finding simple interest in python. The Simple interest formula is given by (PRT)/100. Where P is the principal amount, R is the Interest Rate, and t is the time. The unit of rate is decimal or percentage, and the unit of time is in years.
Introduction
Simple interest is the most basic way to calculate the amount you will earn or pay for an investment or loan.
Mathematically:
Python Program for Simple Interest
Let's understand how to find the simple interest using an example.
In the below program, we are taking the amount, the period in years, and the rate for which a simple interest is to be provided on the amount.
Output:
Python Program to Calculate Simple Interest from User Input
Let's understand how to find the simple interest using an example. In the above example, we initialize value myself. Here we are taking from the user.
In the below program, we are taking the amount from the user, the period, i.e., years, and the rate for which a simple interest will be provided on the amount.
Output:
Python Program to Calculate Simple Interest Using Function
Let's understand how to find the simple interest using a user-defined function using an example.
In the below example, we call a user-defined passing that takes the amount, rate, and total period of time used to calculate the simple interest on the given amount.
Output:
This way, we can calculate the simple interest using a user-defined function.
Conclusion
- The formula to find the simple interest in python is (PRT)/100.
- Simple interest is a method to calculate the amount of interest charged on a sum at a given rate and for a given period.
- In simple interest, the principal amount is always the same, unlike compound interest, where we add the previous year's principal interest to calculate the following year's interest.