Write a program to calculate simple interest in Python
In this exercise, we will learn how to calculate Simple Interest using Python programming language. Simple Interest is a quick and easy method of calculating the interest amount for a particular principal amount of money at some rate of interest. So, simple interest is the simplest and easiest way to determine how much extra you'll have to pay for your loan. For example, when a person takes a loan of Rs. 6000, at a rate of 10 p.a. for three years, the person's interest for three years will be simple interest on the borrowed money.
Simple Interest Formula
The Simple Interest (S.I.) formula is given by -
SI = (P x T x R)/100 Where, P is the principle amount T is the time and R is the rate
Python program to calculate Simple Interest
In the given example, first we created variables as P, R, and T and then assigned the values to the variables. Then, we calculated the simple interest using the formula Simple_interest = (P * R * T)/100 and printed the output.
Output of the above code
The Simple Interest is 200.0
Python program to calculate Simple Interest using function
In the given program, we have defined a function cal_simple_interest() to calculate the simple interest. This program allows a user to enter the principal amount, rate of interest, and number of years. By using these values, the program calculates simple interest -
Output of the above code -
need an explanation for this answer? contact us directly to get an explanation for this answerEnter the principal amount : 10000 Enter the number of years : 3 Enter the rate of interest : 5 The Simple Interest is : 1500.0