Question: 2 Problem 2 : Amortization In this problem, we will create a function that counts the number of monthly payments required to pay back a

2Problem 2: Amortization
In this problem, we will create a function that counts the number of monthly payments required to pay back a loan
Define a function named count_payments(). The function should accept three parameters: amount, rate, and pmt.
The parameter amount represents the initial size of a loan that is to be repaid with monthly payments. The parameter
rate is the monthly rate at which the loan collects interest, and pmt is the size of the monthly payment.
The function should calculate and return the number of monthly payments required to repay the loan. This is calculated
by using a loop. Every time the loop executes, the following steps should be performed:
Calculate the new balance. This will be done by multiplying the current balance by 1+i, and then subtracting
the payment amount. Store the result back into balance, rounded to 2 decimal places.
Increment a variable used to count the number of payments that have been made.
The loop should continue to run for as long as the balance is greater than zero.
The function should not print anything. It should not create any new lists, and should involve only one loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!