1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Financial Concepts in Python

Exercise

Calculating the monthly mortgage payment

In order to make sure you can afford the home, you will have to calculate the monthly mortgage payment you will have to make on a loan that size.

Now, since you will be paying a monthly mortgage, you will have to convert each of the parameters into their monthly equivalents. Be careful when adjusting the interest rate, which is compounding!

In order to calculate the monthly mortgage payment, you will use the numpy function .pmt(rate, nper, pv) where:

  • rate = The periodic (monthly) interest rate
  • nper = The number of payment periods (months) in the lifespan of the mortgage loan
  • pv = The total value of the mortgage loan

You have been given a 30-year mortgage loan quote for your desired amount at 3.75%. The value of the mortgage loan is available as mortgage_loan.

The annual mortgage rate is available as mortgage_rate

Instructions 1/2

undefined XP
    1
    2
  • Derive the equivalent monthly mortgage interest rate from the quoted annual mortgage_rate (Hint: You cannot simply divide by 12).
  • Derive the number of mortgage_payment_periods (months) in the lifespan of the 30-year loan.
  • Calculate the value of your monthly mortgage payment using np.pmt().