# Python program to calculate EMI

In this article, we are going to calculate the monthly EMI of any principal amount with Python programming. For this task first, we need to understand that what is EMI.

**EMI:- **EMI stands for the Estimated Monthly Installment. It is a fixed payment amount made by the customer or borrower to the bank or lender at a fixed date each month of the year. This amount is paid off both interest and principal every month to the fixed number of years until the loan is fully paid by the customer or borrower to the bank or lender.

## Calculation of EMI in Python

For the calculation of EMI, we need to have some data like Principal amount(P), Rate of interest(R) and Time period(T), and EMI is calculated by the given formula:-

** EMI = (P*R*(1+R) ^{T})/((1+R)^{T}-1)**

Here, P = Principal amount or loan amount; R = Interest rate per month; T = Loan time period in year.

Let’s understand with some examples that how to calculate EMI in python.

**Example 1:-**

def emi(p, r, t): # for one month interest r = r/(12*100) # for one month period t = t*12 emi = (p*r*pow(1+r,t))/(pow(1+r,t)-1) return emi principal = 10896; rate = 12; time = 3; emi = emi(principal, rate, time); print("Monthly EMI is= ", emi)

The output will show the monthly EMI as you can see below:

Monthly EMI is= 361.9031197208264

In the above example, we just applied the formula derived above in this article, to calculate the EMI of the given loan amount.

Also, read:

**Example 2:-**

principal = 657432; rate = 9; time = 6; r = rate/(12*100) t = time*12 print("Monthly EMI is= ", round((principal*r*pow(1+r,t))/(pow(1+r,t)-1)))

It will give the output which you can see below:

Monthly EMI is= 11851

In this example, we did the same thing as we have done in the previous example but in this example, we rounded our EMI to the nearest integer.

To calculate EMI for Amount, Period and Interest.. PLZ COULD YOU ANSWER THIS