Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 36 ยท Projects and Practice

Project: A Debt Payoff Planner

Build a program that takes your debts and monthly budget, simulates payoff month by month, and shows the date you become debt-free and the interest paid.

In this project you will build a debt payoff planner: a program that takes a list of debts and a monthly budget and tells you how long it will take to become debt-free, how much interest you will pay, and what an extra payment would change. It uses the amortization and payoff ideas from the earlier lessons (how loans work and snowball and avalanche).

All numbers are invented.

Design

The planner needs four pieces:

  1. Data: for each debt a name, balance, yearly rate and minimum payment.
  2. Monthly step: add interest, pay minimums, send the extra money to the target debt.
  3. Strategy: a function that chooses the target (highest rate, smallest balance, or your own order).
  4. Report: months, total interest, and the month each debt is cleared.
flowchart LR
    A["Debts + budget"] --> B["Monthly step"]
    B --> C{"Any debt left?"}
    C -- "yes" --> B
    C -- "no" --> D["Report"]
    E["Strategy"] --> B

The planner loops month by month until every balance is zero.

Step 1: the planner

Python Debt payoff planner

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 function returns None if the budget is too small to ever clear the debts (a safety stop at 600 months). Check that your budget at least covers the total of the minimums.

Step 2: what would an extra payment do?

A planner is most useful for "what if" questions. Here we compare budgets and ask how much interest an extra amount saves.

Python What if I pay more?

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.

You can see that the first extra amounts are the most valuable, because they attack the most expensive debt.

Step 3: extend it

Ideas to extend the planner yourself:

  • Add a one-off payment (a tax refund or bonus) in a chosen month.
  • Print a month-by-month table of balances.
  • Let the user choose the debt order manually.
  • Add a new monthly spend on the card to see how new borrowing wrecks the plan.

Practical wrap-up

A planner does not replace discipline. The best plan is the one you follow: automate payments, avoid new debt, and celebrate each cleared balance. If you cannot even afford the minimums, contact your lenders early or a free debt advice service in your country; many lenders prefer to agree a lower payment rather than see you default.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. If the budget is less than the sum of minimum payments, the planner

    Minimums must be covered, otherwise you fall behind.
  2. 2. In the planner, extra money goes to the avalanche target, which is the debt with

    Avalanche targets the highest interest rate.
  3. 3. A what-if run shows an extra 100 a month saves 400 in interest. What does that tell you?

    Extra principal lowers balances sooner, so less interest builds up.
  4. 4. What should you do if you cannot afford minimum payments?

    Early contact can lead to a manageable arrangement.

Summary

  • A payoff planner needs debts, a budget, a strategy and a monthly loop.
  • It reports months, interest and when each debt is cleared.
  • What-if runs show the value of extra payments.
  • Always cover minimums; seek help early if you cannot.

Next: Practice Set: Personal Finance Problems