# Python Program to Calculate Simple Interest

In this article, you will learn and get code in Python, to calculate and print simple interest based on user inputs. Here are the list of programs on simple interest using Python:

• Calculate Simple Interest without using Function
• Using user-defined Function

But before going through these programs, let's understand about the formula used to calculate simple interest.

### Simple Interest Formula

To find simple interest, use the formula given below:

`SI = (P*R*T)/100`

here SI indicates to Simple Interest, P indicates to principle amount (deposited/loan amount), R indicates to rate of interest (%), and T indicates to time (in years). If the time period of loan or investment is provided by months, then multiply 100 with 12. That is, we've to enter the time T in years. Therefore for 2 month, the year will be 2/12 or 1/6 or 0.166666666

## Calculate Simple Interest in Python

This program calculate and prints simple interest based on principle, rate of interest, and year provided by user at run-time. The question is, write a program in Python to calculates Simple Interest. Here is its answer:

```# ----codescracker.com----

print("Enter the Principle Amount: ")
p = int(input())
print("Enter Rate of Interest (%): ")
r = float(input())
print("Enter Time Period: ")
t = float(input())
si = (p*r*t)/100
print("\nSimple Interest Amount: ")
print(si)```

Here is its sample run:

Now supply inputs say 200000 as principle amount, 15 as rate of interest, and 2 as years. After supplying all inputs, press `ENTER` key to find and print the value of simple interest as shown in the snapshot given below:

## Calculate Simple Interest using Function

This program does the same job as of previous program, but using a user-defined function named calculateSI(). The function takes three arguments and returns SI. So we've passed all the three inputs by user as its arguments and the return value gets assigned to si. Prints si on output, that is the answer of simple interest.

```# ----codescracker.com----

def calculateSI(a, b, c):
return (a*b*c)/100

print(end="Enter the Amount: ")
p = int(input())
print(end="Enter the Rate of Interest: ")
r = float(input())
print(end="Enter the Time: ")
t = float(input())
si = calculateSI(p, r, t)
print("\nSimple Interest = " + str(si))```

Here is its sample run with user input, 20000 as amount, 10 as interest rate, and .5 (1/2 years or 6 months) as time: