Python Program to Find Simple Interest
In this tutorial, we will learn how to do a simple program of calculating simple interest and displaying it as our result. Simple interest is calculated by dividing the product of Principle amount (P), Rate of interest (R), and Time (T) by 100. We will define a simple function that will take P, R, T as parameters and return simple interest.
Look at the sample input and output of the program which will calculate simple interest on a principal amount of Rs. 1000 at the rate of 2% for 1 year
Step 1 - Define function simple_interest() to calculate SI
Step 2 - Declare variable si to store interest
Step 3 - Return si
Step 5- Print the result
Look at the program to understand the implementation of the approach.
si = (p * r * t)/100
p=int(input("Enter principal amount"))
r=int(input("Enter rate of interest"))
t=int(input("Enter time period"))
print('The Simple Interest is', simple_interest(p, r, t))
Enter principal amount: 1000
Enter rate of interest: 5
Enter time period: 2
The Simple Interest is 100.0
In this tutorial, we have learned how to do a simple program of calculating Simple Interest by taking inputs from the user. We defined a function and passed the user inputs as parameters. Using the formula of P*R*T/100 we calculated the Simple Interest and returned the value. This value was printed and displayed as our result.