In the previous article, we have discussed Python Program to Check if a String is Lapindrome or Not
Estimated Monthly Installment (EMI):
EMI is an abbreviation for Estimated Monthly Installment. It is a set amount of money paid by the customer or borrower to the bank or lender on a set date each month of the year. This amount is deducted from the customer’s or borrower’s account every month for a set number of years until the loan is fully paid off by the customer or borrower to the bank or lender.
Formula :
EMI = (P*R*(1+R)T)/((1+R)T-1)
where P = Principle
T = Time
R = Rate of interest.
Given principle, Rate, Time, and the task are to calculate EMI for the given input values in Python
- Python Program to Compute Simple Interest
- Python Program to Find Volume and Surface Area of Sphere
- Python Program to Check If a Line Touches or Intersects a Circle
Examples:
Example1:
Input:
Given Principle = 10000 Given Rate = 8 Given Time = 2
Output:
The EMI for the above given values of P,T,R = 452.2729145618459
Example 2:
Input:
Given Principle = 20000 Given Rate = 15 Given Time = 3
Output:
The EMI for the above given values of P,T,R = 693.3065700838845
Program to Calculate EMI
Below are the ways to Calculate BMI for given values of principle, Rate, Time.
Method #1: Using Mathematical Formula (Static input)
Approach:
- Give the Principle as static input and store it in a variable.
- Give the Rate as static input and store it in another variable.
- Give the Time as static input and store it in another variable.
- Calculate the given rate using the given rate formula( given rate/(12*100))and store it in the same variable.
- Calculate the given time using the given time formula (given time *12) and store it in the same variable.
- Calculate the EMI Value using the above given mathematical formula and store it in another variable.
- Print the given EMI value for the above-given values of Principle, Rate, Time.
- The Exit of the program.
Below is the implementation:
# Give the Principle as static input and store it in a variable. gvn_princpl = 10000 # Give the Rate as static input and store it in another variable. gvn_rate = 8 # Give the Time as static input and store it in another variable. gvn_time = 2 # Calculate the given rate using given rate formula( given rate/(12*100))and # store it in a same variable. gvn_rate = gvn_rate/(12*100) # Calculate the given time using given time formula (given time *12) and # store it in a same variable. gvn_time = gvn_time*12 # Calculate the EMI Value using the above given mathematical formula and # store it in another variable. fnl_Emi = (gvn_princpl*gvn_rate*pow(1+gvn_rate, gvn_time)) / \ (pow(1+gvn_rate, gvn_time)-1) # Print the given EMI value for the above given values of Principle,Rate,Time. print("The EMI for the above given values of P,T,R = ", fnl_Emi)
Output:
The EMI for the above given values of P,T,R = 452.2729145618459
Method #2: Using Mathematical Formula (User input)
Approach:
- Give the Principle as user input using the float(input()) and store it in a variable.
- Give the Rate as user input using the float(input()) and store it in another variable.
- Give the Time as user input using the float(input()) and store it in another variable.
- Calculate the given rate using the given rate formula( given rate/(12*100))and store it in the same variable.
- Calculate the given time using the given time formula (given time *12) and store it in the same variable.
- Calculate the EMI Value using the above given mathematical formula and store it in another variable.
- Print the given EMI value for the above-given values of Principle, Rate, Time.
- The Exit of the program.
Below is the implementation:
# Give the Principle as user input using float(input()) and store it in a variable. gvn_princpl = float(input("Enter some random number = ")) # Give the Rate as user input using float(input()) and store it in another variable. gvn_rate = float(input("Enter some random number = ")) # Give the Time as user input using float(input()) and store it in another variable. gvn_time = float(input("Enter some random number = ")) # Calculate the given rate using given rate formula( given rate/(12*100))and # store it in a same variable. gvn_rate = gvn_rate/(12*100) # Calculate the given time using given time formula (given time *12) and # store it in a same variable. gvn_time = gvn_time*12 # Calculate the EMI Value using the above given mathematical formula and # store it in another variable. fnl_Emi = (gvn_princpl*gvn_rate*pow(1+gvn_rate, gvn_time)) / \ (pow(1+gvn_rate, gvn_time)-1) # Print the given EMI value for the above given values of Principle,Rate,Time. print("The EMI for the above given values of P,T,R = ", fnl_Emi)
Output:
Enter some random number = 20000 Enter some random number = 15 Enter some random number = 2.5 The EMI for the above given values of P,T,R = 803.5708686652767
Explore more instances related to python concepts from Python Programming Examples Guide and get promoted from beginner to professional programmer level in Python Programming Language.