Welcome, guest | Sign In | My Account | Store | Cart

EMI Calculator is used to calculate Equated Monthly Installment(EMI) for Home Loans/Housing Loans,Car Loans & Personal Advantages: What all this EMI Calculator does?

. The Instant calculation of Loan EMI , Total Interest Payable and Total Payments to be done. . This can be used as EMI Calculator for Banks like HDFC, ICICI, SBI, AXIS etc. . This can be also used for calculating Home loans, Personal Loan, car loans , credit card, LIC loan

How to calculate the EMI?

The well known formula for calculating EMI is:

Formula for EMI calculation

[Formula] EMI = [(p*r/12) (1+r/12)^n]/[(1+r/12)^n – 1 ] where p = principal amount(primary loan amount) r = rate of interest per year n = Total number of Years

output:

https://emilgeorgejames.wordpress.com/2015/07/29/python-emi-equated-monthly-installment-calculator/

for more python recepies visit :https://emilgeorgejames.wordpress.com/

Python, 79 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/python

#@author  :Script written by emilgeorgejames
#@contact :emilgeorgejames[@]gmail.com
#         :emilgeorgejames[@]wordpress.com

#@license :MIT License(Free Open Source license)

#@Description: EMI Calculator is used to calculate Equated Monthly Installment(EMI) for Home Loans/Housing Loans,Car Loans & Personal 
#               Loan in India.#


class EMI_CALCULATOR(object):
     # Data attributes
     # Helps to calculate EMI

      Loan_amount = None # assigning none values
      Month_Payment = None # assigning none values
      Interest_rate = None #assigning none values
      Payment_period = None #assigning none values

      def get_loan_amount(self):
     #get the  value of loan amount
          self.Loan_amount = input("Enter The Loan amount(in rupees) :")
          pass

      def get_interest_rate(self):
       # get the value of interest rate
          self.Interest_rate = input("Enter The Interest rate(in percentage(%)) : ")
          pass

      def get_payment_period(self):
       # get the payment period"
          self.Payment_period = input("Enter The Payment period (in month): ")
          pass


      def calc_interest_rate(self):
      # To calculate the  interest rate"
          self.get_interest_rate()

          if self.Interest_rate > 1:
             self.Interest_rate = (self.Interest_rate /100.0) 
         
          else:
             print "You have not entered The interest rate correctly ,please try again "
          pass

      def calc_emi(self):
      # To calculate the EMI"          

          try:

            self.get_loan_amount() #input loan amount 
            self.get_payment_period() #input payment period
            self.calc_interest_rate() #input interest rate and calculate the interest rate
          
          except NameError:
                 print "You have not entered Loan amount (OR) payment period (OR) interest rate  correctly,Please enter and try again. "
         
          try:
            self.Month_Payment = (self.Loan_amount*pow((self.Interest_rate/12)+1,
                                 (self.Payment_period))*self.Interest_rate/12)/(pow(self.Interest_rate/12+1,
                                 (self.Payment_period)) - 1)

          except ZeroDivisionError: 
                        print "ERROR!! ZERO DIVISION ERROR , Please enter The Interest rate correctly and Try again."

          else:
             print "Monthly Payment is : %r"%self.Month_Payment
          pass


if __name__ == '__main__':# main method 
                              
   Init = EMI_CALCULATOR() # creating  instances

                              
   Init.calc_emi() #to calculate EMI
   

for more information , please visit the site https://emilgeorgejames.wordpress.com/2015/07/29/python-emi-equated-monthly-installment-calculator/

for output:https://emilgeorgejames.wordpress.com/2015/07/29/python-emi-equated-monthly-installment-calculator/

2 comments

srikanth bhandary 6 years, 4 months ago  # | flag

Snippet looks great, but what is the necessity of using pass, when function or class has statements.

Emil george james (author) 6 years, 4 months ago  # | flag

Suppose you are designing a new class with some methods that you don't want to implement, yet.

 class MyClass(object):
       def meth_a(self):
       pass

      def meth_b(self):
         print "I'm meth_b"

If you would leave out the pass, the code wouldn't run. You would then get an: IndentationError: expected an indented block

To summarize, the pass statement does nothing particular but can act as a placeholder, as shown before.