Simple Interest Program in Python

Simple Interest Program in Python | Simple interest is a quick and easy method of calculating the interest charge on a loan. Simple interest is determined by multiplying the daily interest rate by the principal by the number of days that elapse between payments.

We will discuss all possible methods to calculate a simple interest program in python. We will give the principal amount, Rate of Interest, and Time. Python program will calculate simple interest using various methods.

Simple Interest Formula

Simple Interest = ( P x R x T ) / 100
P is the principal amount
R is the rate of interest and
T is the time (number of years)


Input : P = 1000
R = 5
T = 10
Simple Interest = (1000 x 5 x 10) / 100 = 500

Now let’s see how we can implement a simple interest calculator in

Python Program for Simple Interest

This is the simplest and easiest way to calculate the simple interest program in Python. 

Program description:- Write a Python program to calculate the simple interest

# Python program to find simple interest

# store the inputs
P = float(input('Enter principal amount: '))
R = float(input('Enter the interest rate: '))
T = float(input('Enter time: '))

# calculate simple interest
SI = (P * R * T) / 100

# display result
print('Simple interest = ',SI )
print('Total amount = ',( P + SI ))

Output for the different input values:-

Enter principal amount: 1000
Enter the interest rate: 5
Enter time: 10
Simple interest = 500.0
Total amount = 1500.0

Enter principal amount: 7000
Enter the interest rate: 7.5
Enter time: 5
Simple interest = 2625.0
Total amount = 9625.0

Enter principal amount: 25000
Enter the interest rate: 3.8
Enter time: 7.4
Simple interest = 7030.0
Total amount = 32030.0

In this program, Inputs (Principal amount, Interest rate, and time) will be provided by the user. Inputs are scanned using the input() function. input() method reads user input as a string. So, we need to convert it to float first. The principal amount is stored in the variable P, interest rate in R, and time in T.

P = float(input('Enter principal amount: '))
R = float(input('Enter the interest rate: '))
T = float(input('Enter time: '))

Now, calculate the simple interest using formula.

SI = (P * R * T) / 100

Then, simple interest and total amount is displayed using the print() function.

Using Function

This is a different method to calculate simple interest in python. We can also take the help of function. A function is a block of code that performs a specific task.

# Python program to calculate simple interest using function

def calculate_simple_interest(P, R, T):
    # calculate simple interest
    SI = (P * R * T) / 100
    return SI;

if __name__ == '__main__':
    # store the inputs
    P = float(input('Enter principal amount: '))
    R = float(input('Enter the interest rate: '))
    T = float(input('Enter time: '))

    # calling function
    simple_interest = calculate_simple_interest(P, R, T)
    # display result
    print('Simple interest = %.2f' %simple_interest)
    print('Total amount = %.2f' %(P + simple_interest))


Enter principal amount: 15000
Enter the interest rate: 5.4
Enter time: 20
Simple interest = 16200.00
Total amount = 31200.00

In this program, we will be the first defined function. Inputs are scanned using the input() function and stored in variables P, R and T. Then call the function and print the simple interest and total amount.

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or you find anything incorrect? Let us know in the comments. Thank you!

Also See:- Python Program to Add Two Numbers

Leave a Reply