hands-on labIDE in your browser

Boss: The Friday Rush

Level 3's boss. A whole Friday of orders comes in one at a time: the till counts them until closing, reports every hour that had orders, finds the busiest one and keeps working when the prices change, for days you can't see.

time
40 min
checked steps
3
level
Beginner
setup
None

$29.99a month with Pro

Pro opens all 3 steps of this lab and every other lab. Cancel any time.

no account needed · Pro opens all 3 steps

See Pro plans

The job

Friday is the busiest day at Bean There, and Sam wants to know how busy. Your till takes every order as it comes, an hour and a number of cups, until closing. Then it reports the day: hour by hour, the totals and the rush.

3 steps, each checked when you finish it

A check runs your work at the end of every step. Hints and the full solution are there if you get stuck.

  1. 1

    Phase 1: Every order

    Boss rules.

    read this step below ↓

  2. 2

    Phase 2: Hour by hour

    Sam wants to see the rush.

  3. 3

    Phase 3: The busiest hour

    The report's last line: the hour that sold the most cups.

Step 1 as it appears in the lab

The lab’s own text. The hint and the solution stay inside the lab.

Step 1: Phase 1: Every order

Phase 1: Every order

Boss rules. One file, till.py. The output must match exactly. From Phase 2 on, the check plays whole days you can't see and tells you how many reports came out right, and what the first wrong one should have been. The hint nudges; it won't write the till for you.

The till. Friday is the busiest day at Bean There. Every order is an hour and a number of flat whites: the till asks Hour: , then Cups: , then the same for the next order, until Sam types close instead of an hour. Then it prints the day:

Today: 8 orders, 19 cups, £55.90

A cup costs FLAT_WHITE, and in happy hour, 15:00 up to 17:00, HAPPY_PRICE. With exactly one it's 1 order and 1 cup. A day nobody came prints Today: 0 orders, 0 cups, £0.00.

Press Run to play Friday's first eight orders (friday.py types them in), or type python3 till.py in the terminal and take orders yourself. The check plays that Friday, a day with a single order and a day nobody came.

till.py, the file you edit7 lines
# Bean There's till, Level 3: the Friday rush. Prices are in whole pennies.
FLAT_WHITE = 320
HAPPY_PRICE = 250   # a flat white in happy hour, 15:00 up to 17:00

# Your till: take the day's orders one at a time. Each order is an hour and a number of cups,
# asked as "Hour: " and then "Cups: ". When Sam types close instead of an hour, the day is over:
# print the report in the brief.

provided for you:friday.py

what you get

  • An editor and terminal in your browser
  • A check at the end of every step
  • Hints and the full solution
  • Nothing to install or configure

before you start

  • Level 3's quests: while, for, range, break, continue, counters and running totals

Part of the Learn Python track

Lab 15 of 15. Learn Python by running a café till: receipts, orders, discounts and the Friday rush. Nothing to install.

Questions about this lab

Can I see the hidden days?

When a report is wrong, the checker shows that day's orders, what your till printed and what it should print.

How this challenge works

A level's final challenge asks for its skills at once. You get the report Sam wants and its exact output, and the checker plays whole days of orders you can't see, telling you how many reports came out right and what the first wrong one should have been. Each phase adds to the report.