Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi! The task is to write a function that will calculate the remaining principal on a loan for a specified month. We MUST use a

Hi! The task is to write a function that will calculate the remaining principal on a loan for a specified month. We MUST use a WHILE loop to do this in Python. Please see the attached photo for expected outcomes, thank you! Appreciate help.
image text in transcribed
of money you initially borrow), the annual interest rate (in percentage) and the duration of the loan (e.g. 30 years). A mortgage payment is due every month for the duration of the loan. There are other nuances (such as making extra payments, purchasing points, etc) that we will ignore in this problem. Given the principal amount P. monthly interest rate ' r ' and the duration of the loan ' n ' in months, the monthly mortgage payment M is calculated. by the formula: M=P((1+r)n1r(1+r)) Part of each monthly payment goes towards the interest, and the remaining part goes towards reducing the principle (for exarnple, if one pays $500 per month, $100 may go towards the principal and $400 towards the interest). This is done by computing the interest owed on a monthly basis, depending on the remaining principle in that month. Let us take an example. Suppose our principal is $600000, borrowed at an annual rate of 6% over 30 yeari ( 360 months). By the above formula, the monthly payment is $3597.3. Month 1: Remaining principal: $600000 Monthly interest rate: 0.5%(6/12) Interest due on the principal this month =0.005600000=$3000 Part of piryment that goes towards interest: $3000 Part of payment that goes towards principal =3597.33000=$597.3 Month 2: Remaining principal: 600000597.3=$599402.70 Monthly interest rate: 0.5(6/12) Interest due on the principal this month =0.005+599402.7=$2997.01 Part of payment that goes towards interest $2997.01 Part of payment that goes towards principal =3597.3.2997.01=5600.29 Month 3: Remaining principal =599402.7600.29=$598,802,41 (Notice how at the end of two months, despite paying almost $7200, our principal went down only by about $1200 : We can see how our most of our payments in the initial years 80 towards interest, and the principal goes down slowly). It is useful to answer this forward-looking question: Given the principal, annual interest rate and duration of the loan, how much principal will be remaining at the end of a certain month? In the above example: given a principal of $600000 borrowed at an annual interest rate of 6% over 30 years, the principal remaining at the end of month 2 is $598,802.41. In this programming assignment, you will write a function orincipal remaining by (principal, ianual_interest_rate, duration_in_monthg, by_month): - principal is the initial amount borrowed - annual interest rate is in percentage (e.g. 6% ), but just as a number (i.e. no % sign) - duration_in_months is the duration of the loan in months

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions