Pebellslearn by building
0%
RoadmapMatrixCatalogSandboxSign in
Fundamental's Follow up Projects  ›  Capstone Project

Project 1 — Terminal Café POS

Capstone Project 40 minAssemble a point-of-sale: menu, promos, tax, tip, and bill splitting
Your task
Build checkout(menu, orders, code, people). Subtotal the order, apply the promo code, add 8% tax and 18% tip on the discounted subtotal, split between `people`, and return {"subtotal", "discount", "total", "per_person"}.

Project 1 — Terminal Café POS

Time to combine everything. You'll build the checkout engine for a small café's point-of-sale — the code that turns a table's order into a printed total.

By the end, checkout(menu, orders, code, people) will: look up each dish in the menu, apply a promo code, add 8% tax and an 18% tip on the discounted subtotal, and split the bill between the diners — returning a receipt dict.

Build it in four graded steps (in the Practice cards below), then assemble the whole thing in the editor on the right (Your task). Each step is checkable on its own, so you always know a piece works before you wire it in.

  • Step 1 — menu_total: subtotal an order against the menu (unknown dishes are free).
  • Step 2 — apply_promo: SAVE10 / HALF discounts.
  • Step 3 — add_tax_tip: 8% tax + 18% tip.
  • Step 4 — split_bill: per-person share, never dividing by zero.

Then the capstone — checkout — chains them into one receipt: {"subtotal", "discount", "total", "per_person"}.

Skills you'll use: dicts + .get, generators, conditionals, guards, rounding money, and f-string-free arithmetic — the core of every real app.

Practice — level up

0/4 solved

Solve each in its own editor — Run to try, Check to grade. Stuck? Reveal a Hint, or the full Solution + walkthrough.

BuildStep 1 — Menu subtotal

The café's menu is {dish: price}; an order is a list of dish names (repeats allowed). Write menu_total(menu, orders) returning the subtotal — unknown dishes cost 0. Round to 2 decimals.

dict.getgeneratorsum
BuildStep 2 — Promo codes

Write apply_promo(subtotal, code) returning the subtotal after a discount: "SAVE10" → 10% off, "HALF" → 50% off, anything else → no change. Round to 2 decimals.

dict.getconditionalsround
BossStep 3 — Tax & tip

Write add_tax_tip(subtotal, tax_rate, tip_percent) returning subtotal + tax (subtotal * tax_rate) + tip (subtotal * tip_percent / 100), rounded to 2 decimals.

arithmeticround
BossStep 4 — Split safely

Write split_bill(total, people) returning the per-person share (2 decimals). If people is 0 or negative, return 0.0 (never crash).

guardround
checkout.py
Call the function you wrote — just like your app's frontend would. Edit the inputs and hit Call.
checkout(menu, orders, code, people) → dictRun a full café order: subtotal, promo, tax+tip, split.
try:
returned
No app map for this section yet.
Press Run to execute your code.
Press Check to run the tests for this lesson.