Paul's Python CoursePPC

Project 10 of 20, for Caitlin

Order Book

Caitlin's bake sale stock numbers change on their own. Find out why, then build the order book that never touches the standing orders.

About 60 minutes, in 15 steps.

Sign up free to open itLog in

Act 2 needs a free account, so your work is saved as you go. Act 1 is open to everyone.

The brief

  • CaitlinI run a bake sale on Fridays and Saturdays to raise money for new board games for the Studio.
  • CaitlinSaturday's sheet said we'd sold thirty-five loaves by nine, and we'd only been open ten minutes.
  • CaitlinI wrote the stock program last term and I've counted three times, but it's still wrong.
  • PaulHmm, numbers don't move on their own. I reckon something else is holding the same box.

Caitlin's stock program keeps a sheet for each day of the bake sale. Find out why one day's sales turn up on the next day's sheet, and fix it.

Then write saturday_orders(standing, extras) for the bake sale's standing orders. It returns Saturday's orders, the standing orders with this week's extras added, and leaves both of its arguments exactly as they were.

What it prints
bread: 35 left of 40
buns: 60 left of 60
brownies: 12 left of 12

What you learn

What's in it

  1. Labels on boxes
  2. Two labels, one box
  3. What can change
  4. Numbers and trays
  5. The same, or the same one
  6. Same, or the same one
  7. How deep a copy goes
  8. How deep is a copy
  9. Reading Caitlin's stock sheets
  10. Fix the stock sheets
  11. How Paul would do it
  12. Fix Riya's version
  13. Make Saturday's orders
  14. Ship it