Develop and test a Python program that calculates the monthly mortgage payments for a given loan amount, term (number of years) and range of interest rates from 3% to 18%. The fundamental formula for determining this is A/D, where A is the original loan amount, and D is the discount factor. The discount factor is calculated as,
D = ((1 + r)^n - 1) / (r(1 + r)^n)
where n is the number of total payments (12 times the number of years of the loan) and r is the interest rate, expressed in decimal form (e.g., .05), divided by 12. A monthly payment table should be generated as shown below,
Loan Amount: $350,000 Term: 30 years
Interest Rate Monthly Payment
3% 1475.61
4% 1670.95
5% 1878.88
6% 2098.43
.
.
.
.
18% 5274.80
Check your results with an online mortgage calculator.