We can use Python to calculate mortgage payments when purchasing a home. Let’s consider the following:
- Home cost: $430,000
- Down payment: 6%
- Interest rate: 3.12%
- Insurance: $131
- Property taxes: 0.086%
- Loan type: 30-year fixed
We begin by importing numpy and calculating the down payment. Based on the calculations below, we see the down payment will cost $25,800, leaving a balance of $404,200.
Now let’s calculate the monthly interest rate. As listed above, the total interest rate for this property is 3.12%. However, we cannot calculate the monthly interest rate by simply dividing 3.12 by 12.
Based on the calculations below, we see the monthly interest rate is 0.256%
So, we have the total loan amount after the down payment. We have the monthly interest rate. And we know how many total payments we will have to make (30 years x 12 months = 360 payments).
We now determine the total monthly payment, before taxes and insurance, to be $1720.79.
Finally, we’ll add the insurance and taxes to determine the total monthly payment.
And now, we see the total monthly payments, after taxes and insurance, is $2221.59.
Salaam
Big fan of the Islamic history podcast, what is the best resource to learn Python and /or with no prior coding background?
Probably DataCamp. It’s not free but it is a good source.