EMI and SIP Calculator in Python

Nioneer
Python in Plain English
2 min readMay 22, 2021

--

Part 1: Code Implementation of EMI & SIP calculator in Python

Photo by Tierra Mallorca on Unsplash

In this post, we are going to create 2 functions using python to calculate the EMI amount and SIP amount. Without further ado, let’s jump into action.

EMI: Equated Monthly Installments; The monthly installment, that needs to paid to set off an existing loan/borrowing.

SIP: Systematic Investment Plan; An investment habit, which will help us accumulate wealth for the future.

With our EMI calculator, we will calculate the monthly installments that need to be paid to the borrower and with our SIP calculator, we will calculate the maturity amount.

The above code is for the EMI calculator, it takes in 3 mandatory arguments along with 2 optional arguments.

  1. amount: the total loan amount
  2. tenure: duration of the loan in years. It can also be specified in months, but we need to then pass the optional parameter “is_year=False”
  3. interest: the rate of interest (ROI) per annum. This is specified in percent. It can also be specified as a decimal value, but we need to then pass the optional parameter “is_percent=False”

The above code is for the SIP calculator, it takes in 3 mandatory arguments along with 3 optional arguments.

  1. investment: monthly investment amount
  2. tenure: duration of the loan in years. It can also be specified in months, but we need to then pass the optional parameter “is_year=False”
  3. interest: expected investment return per annum. It is specified in terms of percent. It can also be specified as a decimal value, but we need to then pass the optional parameter “is_percent=False”
  4. amount: the initial amount for the investment. by default, it is set to 0
  5. show_amount_list: if true, the output will include a detailed growth list

Let’s see the calculator in action…

EMI calculator: let’s check the EMI for a loan amount of 10000 at an interest of 20% per annum for a period of 1 year.

from emi import emi
EMI = emi(10000, 1, 20)
print(EMI)
{'EMI': 926.345058970803, 'Total Repayment Amount': 11116.140707649636, 'Interest Amount': 1116.1407076496362}

The EMI comes to around 926

SIP Calculator: let’s check the maturity amount for a SIP of 500 per month with an estimated ROI of 12% per annum invested for a period of 10 years

from sip import sip
SIP_maturity = sip(500, 10, 12)
print(SIP_maturity)
{‘Amount @ Maturity’: 116169.53817597013}

The SIP amounts to 116169.

Feel free to use the calculator to calculate your EMI’s and SIP maturity amount, and do not forget to post your queries in the comment section.

If you found this to be interesting, feel free to clap. Thank you!

Check out Part Two for Packaging Python code and pushing it to PyPI.

More content at plainenglish.io

--

--

Hi, we at Nioneer are building the post-pandemic career ecosystem. Keep in touch to reap the benefits and witness our journey