Sample lab · public practice
Club capacity investigation
Trace the authored countAvailable procedure through a list of club capacities. Revisit the sample lesson at any time.
Loading saved work…
Interactive example — not a general interpreter
Brief
Scenario
The student council keeps a list of how many places remain in each club. A student who needs a certain number of places — perhaps for themselves and two friends — wants to know how many clubs could take them.
Learning objectives
- Trace iteration (FOR EACH) and selection (IF) through a list.
- Explain what the minimum parameter does and why it makes the procedure reusable.
- Connect a list of capacities to a useful task for students.
Instructions
- Read the procedure in the centre panel.
- Enter a prediction for the returned value, then select Predict.
- Use Step to move one element at a time, or Run trace to finish.
- Try each preset dataset and a minimum of your own.
- Check the authored tests, then write your reflection.
Checkpoints
Checkpoints met0 of 4
- Make a prediction(not yet)
- Trace to the RETURN line(not yet)
- Check the authored tests(not yet)
- Write a reflection(not yet)
Interactive example
PROCEDURE countAvailable(capacities, minimum){ count ← 0 FOR EACH places IN capacities { IF (places ≥ minimum) { count ← count + 1 } } RETURN count}Preset minimum. You may enter any nonnegative whole number.
Predict before you trace.
Step0 of 5
Current elementnot started
count—
| Position | places (value) | places ≥ minimum | count after |
|---|---|---|---|
| count ← 0. Select Step to examine the first element. | |||
Result
Finish the trace to reach RETURN count.
Support
Notes
Hints
Hints are written in advance. There is no AI tutor.
Authored tests
- [0, 5, 2, 8], 3 → expected 2Several matches: two clubs have at least 3 places left.Not checked
- [0, 5, 2, 8], 2 → expected 3Equal to the threshold: 2 ≥ 2 is true, so the club with 2 places counts.Not checked
- [0, 5, 2, 8], 9 → expected 0No matches: no club has 9 or more places.Not checked
- [3, 3], 3 → expected 2Boundary: every value equals the minimum, and ≥ includes equality.Not checked
- [], 3 → expected 0Robustness test: the loop body never runs, so count stays 0. This is an authored edge case, not a Create task suitability claim.Not checked
Reflection
This demo copy is not sent to a teacher
To hand work to your teacher, open the assignment from your class after signing in. Completing practice here only saves a completion mark on this device.
Meet all 4 checkpoints first (0 of 4 met).