Python Program to find Simple Interest

This is a Python program to find the simple interest for a principal amount at a given rate for a given time.
Simple Interest is given by the following formula

S.I. = (P * R * T)/100

Where S.I. stands for Simple Interest, P for Principal, R for rate and T for time.

Let us now make the Program.

Program

p = int(input("Enter the amount: "))
r = int(input("Enter the rate of interest:"))
t = int(input("Enter the time in years"))

simple_interest = (p * r * t)/100

print("The calculated Simple Interest is {}" . format(simple_interest))

Output:

Enter the amount: 20000
Enter the rate of interest: 5
Enter the time in years: 2
The calculated Simple Interest is 200

Explanation

  • When the program executes, the user will see messages for principal, rate and time to be entered consecutively. The principal amount, rate and the time entered by the user will then be stored in the variables named p, r, and t respectively.
  • The simple interest will be calculated by the formula and will be stored in the variable named simple_interest.
  • Lastly, with the print function, the output will be displayed with a message, the output will be displayed with a message.

program by creating a function

In this program we have made a function named as findSI(). This function will take three arguments – principal, rate, and time. It would multiply the three arguments, divide the result by hundred, and return it. The returned value would be the simple interest.

def findSI(principal, rate, time):
    si = (p * r * t)/100
    return si

p = int(input("Enter the amount: "))
r = int(input("Enter the rate of interest:"))
t = int(input("Enter the time in years"))

simple_interest = findSI(p, r, t)

print("The calculated Simple Interest is {}" . format(simple_interest))