1. Lighthouse

Level 1 · What will the racking loan cost each month?

The request

From Daniel Brooks, Head of Operations

“The warehouse needs new pallet racking. The supplier's quote is $48,000 and the bank offers 7.5% a year over 5 years, paid monthly. What's the monthly payment, and how much do we pay the bank in total?”

Your goal

Set result to a dict: "payment", the monthly payment on a $48,000 loan at 7.5% a year over 5 years with monthly payments, "total_paid", all payments added up, and "interest", the total paid minus the amount borrowed, each rounded to 2. Give the payment as a positive number.

  • Store a dict in resultnot done yet

Your code

Python

Loading the editor…

    ResultPress Run to see yours

    Mote checks your result

    Press Run. Each row that matches the goal becomes a firefly in your lantern.

    The lesson

    Why a loan payment is not price ÷ months

    $48,000 over 60 months would be $800 a month if money were free. It isn’t: each month the bank charges interest on what you still owe. A fixed monthly payment that covers both that interest and a slice of the debt, ending at exactly zero after the last payment, is called an annuity. Early payments are mostly interest; late ones are mostly repayment.

    The formula

    With a monthly rate r and n payments, the payment on a loan of P is:

    payment = P * r / (1 - (1 + r) ** -n)

    For the racking: r = 0.075 / 12 = 0.00625, n = 5 * 12 = 60.

    r, n = 0.075 / 12, 60
    48_000 * r / (1 - (1 + r) ** -n)      # 961.82

    The (1 + r) ** -n part is how much one dollar paid at the very end is worth today. You don’t need to derive it, but you should recognise it: it is the same in every loan, lease and mortgage calculation.

    The same thing in Excel

    Excel’s PMT(rate, nper, pv) does exactly this:

    =PMT(7.5%/12, 5*12, 48000)      → -961.82

    The minus sign is Excel’s sign convention: money you receive (the loan) is positive, money you pay out is negative. It is not an error. Wrap it in -PMT(...) or ABS(...) when you want to show a positive payment in a report. Python has no such convention unless you add one, which is why the task asks for a positive payment.

    The number the decision needs

    total = 961.82 * 60          # about 57,709
    total - 48_000               # about 9,709 of interest

    A monthly payment answers “can we afford it this month?”. The total interest answers “is it worth it?”. If the racking lets the warehouse ship more orders, compare its cost with that gain, and put both numbers in front of the person deciding.

    Common mistakes

    • Annual rate with monthly payments. pmt(0.075, 60, …) charges 7.5% every month and gives $3,647.59 instead of $961.82.
    • Years as the number of payments. With 5 instead of 60 you get a five-payment loan of $9,780.75 a month.
    • Rounding the rate. Keep 0.075 / 12 as it is; rounding it to 0.0063 changes the payment by a few dollars and the total by more.
    • Reporting the payment without the total. The cheapest-looking monthly payment often hides the most interest.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.