How to find Simple Interest in Python?

Hello Coders, In this blog post, you will learn to find Simple Interest in Python. The formula to find simple interest is (p * r * t)/100 where p is the principal amount, r is the rate of interest and t is time. Let us learn about it in detail:-

Simple Interest in Python

 

Simple Interest 

Input:- P = 1000

            R = 10%

            T = 1 Year

Simple Interest = 100 

 

Code to Find Simple Interest in Python :-

In this Code, We will define a function simpleint() with the help of the def function. Under this simpleint() function we will also write the print command to print the principal, rate of interest, and time. si formula (p * r * t) /100 will also be applied under this. Our simpleint() function is completed.

 

Now we will take the p, r, t as input from the user using the int for taking only integer value. After taking the input we will redirect this input in simpleint(p,r,t). Our code to Find simple interest in Python is ready.

Simpleint.py

 
# Simple Interest in Python
# Creating simpleint function using Def
def simpleint(p,r,t):
    print( “Principal amount is :”,p)
    print( “Rate of Interest is :”,r)
    print( “Time Period is :”,t)
   
    si = (p * r * t)/100

 

    print(“The simple interest is :”,si)

 

# Taking Input from user for various values pf P,R,T
P = int( input(“Enter Principal amount : “))
R = int( input(“Enter the Rate of Interest : “))
T = int( input(“Enter Time Period : “))

 

simpleint(P,R,T)
 

OUTPUT

Enter Principal amount : 10000
Enter the Rate of Interest : 12
Enter Time Period : 5
Principal amount is : 10000
Rate of Interest is : 12
Time Period is : 5
The simple interest is : 6000.0

Hope this blog post was helpful to you and you have got the answer to your question. Thank you for visiting our blog. If you have any doubts about any coding questions then let us know in the comments section we will answer them as soon as possible. Till then check out our more blog posts.

Leave a Comment

Your email address will not be published. Required fields are marked *