DEV Community

Kawalpreet Kaur
Kawalpreet Kaur

Posted on

Education Mortgage Calculator in Python

Background

Hello there! I'm on an exciting journey as I pursue my M.Tech in Computer Science & Engineering. I've been delving into the world of Python, learning its ins and outs. Once I got the hang of the basics, I jumped right into an engaging project for my portfolio. Let me share the story with you!

Imagine this: I'm right in the middle of figuring out how to fund my education. That's when it hit me—why not make my very own tool to guide me in choosing the best education loan? And that's how my Education Loan Calculator idea came to life.

You know what I wanted? A simple tool to compare different loan options based on what I need for my studies. I've put my heart into crafting a calculator that considers important stuff like the total loan amount, total interest to be paid , and the loan duration. Hence, painting a clear picture of my financial responsibilities and helps me make smart choices about financing my education.

Here, is a video showing working of my portfolio project:

Terminal based Education loan Calculator

This code defines a Python class called EducationLoanCalculator that helps calculate and display details about education loan payments. Let's break down how it works step by step:

  1. Initialization (__init__ method):

    • The class is initialized with two lists: private_banks containing names of private banks and govt_banks containing names of government banks.
    • The format_inr method is defined to format numeric amounts as Indian Rupees (₹) with two decimal places.
  2. Bank Selection (select_bank_type and select_bank methods):

    • select_bank_type displays an ASCII art banner representing the calculator and prompts the user to choose between government and private bank loans.
    • Depending on the user's choice, the program sets self.banks to the respective list of banks.
  3. Bank Selection and Loan Details (select_bank and get_loan_details methods):

    • select_bank displays a list of available banks based on the previous choice.
    • The user selects a bank, and the chosen bank's name is stored in self.selected_bank_name.
  4. User Input and Loan Calculation (get_loan_details and calculate_loan methods):

    • get_loan_details prompts the user to input the loan amount, interest rate, and loan term.
    • calculate_loan computes the monthly payment, total payment with interest, and total interest paid using mathematical formulas.
  5. Displaying Loan Details (display_loan_details method):

    • display_loan_details presents the final calculated details of the education loan, including bank name, loan amount, interest rate, loan term, monthly EMI, total interest paid, and total payable with interest.
  6. Running the Calculator (run method):

    • The run method orchestrates the entire process by calling the previously defined methods in the appropriate order.
  7. Main Program (if __name__ == "__main__":) block:

    • An instance of the EducationLoanCalculator class is created.
    • The run method of the instance is invoked, initiating the calculator's operation.

When you run this script, the program guides you through selecting a type of bank loan, choosing a bank, entering loan details, calculating payments, and finally displaying the comprehensive education loan details based on your inputs. This object-oriented approach helps organize the program's functionality into well-defined methods and enhances code readability and maintainability.

For those curious about the inner workings, you can access the complete source code here

Conclusion

Summing up my Python basics exploration, I've built something interesting—an Education Loan Calculator. It helps me pick the best education loan by comparing things like loan amount, interest, and time.

Want to see it in action? Check out this video. And if you're curious about the code, you can find it on GitHub.

This project shows how coding can make complex choices easier. Thank You!

Top comments (0)