can someone help me with the formula to use with python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can someone help me with the formula to use with python

Function 6: Loan Pay-Off Period Calculator Write a function pay_off_period(PV, PMT, i) that calculates the minimum number of years left until a loan is fully paid off, if: the amount owned on the loan is currently equal to PV, the loan is repaid at an amount, PMT at the END of every YEAR (with the first payment exactly 1 year from now), at an interest rate of i% per year, compounded annually. IMPORTANT: Your function may not call any of the other functions you've defined in this project. Just like in Function 4 and 5, calculate the loan as the present value of the future down-payments on the loan, discounted at an interest rate of i% per year. (Use the present value of an annuity formula, a.k.a. discounted cash flow valuation - https://www.investopedia.com/walkthrough/corporate-finance/3/discounted-cash-flow/introduction.aspx) ### START FUNCTION 6 def pay_off_period(PV, PMT, i): # YOUR CODE HERE return int(n) ### END FUNCTION 6 IMPORTANT: Your function needs to return an int. Make sure that the following tests all give a True result: pay_off_period(1635153, 15000*12, 0.1045) == 30 pay_off_period(1578934, 15000*12, 0.1045) == 25

24th Sep 2018, 12:28 PM
Thendo
1 Answer
- 1
Your hyperlink has a result of 404: Page Not Found The page you requested could not be found. It may have moved or does not exist. 😅😅😅 And from your descriptions, in the same assignment, there are function 4 and function 5, which discount future values to present. I assumed you have done those yourself and fully understood them. Now, one of the way to do function 6 is to use if-else statements to compare the PV and present values of PMT. If you don't understand the math, use while loop to compare year-by-year (But that's not what the description is restricting you)
28th Sep 2018, 3:07 PM
Gordon
Gordon - avatar