Class 9 · Unit project
Unit 5 project: A program for a real job
Write a program someone in the valley could actually use. Then prove it works — by predicting every answer before you run it.
The task
You have written five programs this unit, each one following the book. Now your group writes one of its own, for a real person with a real job — and tests it the way programmers do: by predicting every answer before the computer gives it.
Work in groups of 3–4. One period. Save as our-program.py, with the test table in
tests.ods.
Choose a job (4 min)
Pick one, or propose your own:
- The fair price — ask for two boxes' prices and weights; say which is cheaper per kilo, and by how much.
- The grader — ask for an apple's size and whether it has scab; print A, B, C or Reject.
- The class average — store a week's temperatures (or attendance counts) in a list; print the mean, the highest and the lowest.
- The fee helper — ask how many months are paid; print what's still due and whether it's overdue.
Build it (18 min)
Your program must use all of these at least once:
input()withint(...)orfloat(...)- variables with clear names,
like_this - at least two operators
if/elif/else- a list or a
for/whileloop - comments (
# like this) explaining the tricky lines
Test it (12 min)
In tests.ods, fill at least five rows: Input · What we predict · What it printed · Right?
- Three ordinary inputs.
- One edge case — a value right on a border, like exactly 8 cm.
- One bad input — a word where a number should be, or a zero where you divide. What happens? Is that acceptable for the person who'd use it?
Predict every row before you run it. Where a prediction was wrong, write which of you was wrong — you, or the program.
Your own line (6 min, alone)
Swap programs with another group. Dry-run theirs on paper for one input you choose: a column for each variable, one row per line that runs, and the final output. Sign with your roll number. This part is marked for you alone.
How it is marked
Each row is marked 0–3. Rows 1–5 are shared by the group; row 6 is yours alone. Marks are returned privately and never compared with anyone else's.
Total: 18. A short program, honestly tested, beats a long one nobody tested.
1. It runs
- 0Doesn't run
- 1Runs, but not the job
- 2Does the job
- 3Does the job, and the output is clear to its user
2. The parts
- 0Fewer than half
- 1Most of the six
- 2All six
- 3All six, used where they make sense
3. Readable
- 0No comments, unclear names
- 1Some comments
- 2Clear names and comments
- 3Someone new could follow every line
4. The test table
- 0Missing
- 1Run, not predicted
- 2Five rows, predicted first
- 3Five rows, predicted first, wrong predictions explained
5. Edge case and bad input
- 0Neither
- 1One tested
- 2Both tested
- 3Both tested, and the program changed to handle one of them
6. The dry run
Just you- 0Missing
- 1Output only
- 2Variables traced line by line
- 3Traced correctly, and a bug or edge case spotted