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/HALFdiscounts. - 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.
