Skip to content

Lesson 10 ยท Time Value of Money

Loan Amortization Schedules

Build a loan amortization schedule in Python, handle rounding and extra payments, compare loan structures, and measure the true cost including fees.

An amortization schedule shows, payment by payment, how a loan is repaid. For each period it splits the payment into interest and principal (repayment of the amount borrowed). Businesses need this for budgets, balance sheets and decisions about which loan to take.

If you want the consumer view, read how loans work. Here you build the model.

The level payment

For a fixed rate and equal payments made at the end of each period:

payment = P ร— r / (1 - (1 + r)^-n)

P is the amount borrowed, r the rate per period and n the number of payments. If the rate is zero, the payment is simply P / n.

Each period: interest = balance ร— r, principal = payment - interest, new balance = balance - principal. Early payments carry the most interest because the balance is large.

Rounding matters

Real loans round to the smallest currency unit. Rounding each payment leaves a small remainder at the end, so the last payment is usually adjusted to bring the balance to exactly zero. For money, Python's decimal module avoids binary floating-point surprises. Lenders have their own rounding rules, so your schedule may differ from theirs by a few cents.

Python A rounded amortization schedule

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

We divide a nominal annual rate by 12 here because the example loan is quoted with monthly compounding. Real contracts may count days or use other rules.

Extra payments

Paying extra principal reduces the balance, so later interest is smaller. Check the contract for prepayment fees or limits first.

Python Effect of an extra monthly payment

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the guard clause. If the payment does not cover interest, the loop would never end, and the debt would grow.

Other loan structures

Common repayment shapes

Level payment Same total each period
Equal principal Payments fall over time
Bullet or balloon Large amount due at the end
1 / 2

An interest-only period lowers early payments, but the principal remains. A balloon loan needs a large final amount, which creates refinancing risk: you may not get a new loan on good terms when it is due. A variable-rate loan changes with a reference rate, so you should test higher rates.

Which loan costs more?

Compare loans using all cash flows, including fees. A fee paid up front means you effectively receive less money than you borrow. The effective cost is the rate that makes the present value of the payments equal to the money you actually received. Solve it with bisection: try a rate in the middle, then halve the range.

Python Effective annual cost including a fee

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The lower quoted rate is the more expensive offer once the fee is included. Legal rate labels have their own definitions, so this is an analytical measure, not a legal disclosure. Fees also matter differently if you repay early, so test that case too.

Putting a loan into the statements

In a model, each year's interest goes to the income statement, principal repaid is a financing cash flow, and the remaining balance appears on the balance sheet, split into the part due within a year and the rest.

Splitting a year's totals

Financial statements work in periods, not payments. To feed a yearly model, add up the interest and principal for the months in each year. The balance at the end of the year goes on the balance sheet. The principal due in the next twelve months is usually shown as a current liability, and the rest as non-current.

This split affects liquidity ratios: a loan that moves into its final year suddenly increases current liabilities, even though nothing unusual happened.

Testing a rate rise

For a variable-rate loan, recalculate the payment on the remaining balance and remaining term at a higher rate. For example, ask what happens if the rate is two or three points higher. Then check whether your cash forecast can absorb the larger payment. The size of the test is a judgment, so say why you chose it.

Check your schedule

  • The sum of all principal parts equals the amount borrowed.
  • The final balance is exactly zero.
  • Total payments equal principal plus total interest.
  • Interest never exceeds the balance times the periodic rate (apart from rounding).
  • The lender's statement matches your schedule, or you understand why it differs.

Those checks take a minute and find most coding errors.

Common mistake: treating the whole payment as an expense. Interest (and, under the relevant accounting rules, fees) is an expense. Principal repayment reduces a liability.

Practice tasks

Try each task on paper or in the editor above before you read the answer. When your result differs, compare definitions first, then timing, then arithmetic.

Task 1. You borrow 12,000 at 12% nominal, compounded monthly. What is the interest part of the first payment?

Answer: The monthly rate is 1%, so the first month's interest is 120. Any amount you pay above 120 reduces the principal.

Task 2. An interest-free loan of 6,000 is repaid in 24 equal payments. What is each payment?

Answer: With a zero rate, the payment is 6,000 / 24 = 250. The general formula would divide by zero, which is why the code needs a separate case.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In a fixed-rate level-payment loan, the interest part of each payment usually

    Interest is charged on a balance that shrinks.
  2. 2. Which part of a loan payment is an expense?

    Repaying principal reduces debt and is not an expense.
  3. 3. Why include fees when comparing loans?

    A low rate with a large fee can cost more.
  4. 4. What is refinancing risk on a balloon loan?

    A large final amount may require new borrowing at an unknown cost.

Summary

  • Each payment splits into interest on the balance and principal.
  • Round to cents and adjust the last payment.
  • Guard against payments that do not cover interest.
  • Compare loans by all cash flows, including fees.
  • Interest is an expense; principal changes the debt balance.

Next: Building Project Cash Flows

Your progress is saved in this browser. No account needed.