Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Flashcards: open the module flashcards (end-of-module review with workplace questions).

Online Courses / University Track / Python from Zero

Module 8 · Capstone

Lab: plan a program, review a test plan and write a hand-over note

Plan a small program on paper, find the gaps in a test plan and write the limits of a finished program.

  • 50 minutes
  • 16 marks
  • Self-marked

50 minutes. Self-marked against the rubric. 16 marks. In the full course this counts toward the labs and cases share (15% of the course grade). Write your answers in the boxes, then open the model answer and tick each mark you earned honestly. Nothing is sent or stored.

Scenario (invented)

A school office (invented) wants a program that reads marks.csv, with columns name,mark, and prints each pupil's grade and the class average. A, B and C use marks of 70 and over, 50 to 69 and under 50.

A colleague proposes this test plan:

Test 1: a file with three pupils, marks 90, 60, 30.
Test 2: a file with one pupil, mark 75.

Tasks

Task 1 (5 marks)

Write a plan: the user and need, the input, the output and three functions with one job each.

Private: nothing you type here is sent or stored.

Task 2 (4 marks)

Name four kinds of case missing from the colleague's test plan and give an example of each.

Private: nothing you type here is sent or stored.

Task 3 (3 marks)

For marks 70, 69 and 50, give the grades and the average.

Private: nothing you type here is sent or stored.

Task 4 (4 marks)

Write the Limits and Tests lines of the hand-over note for the finished program.

Private: nothing you type here is sent or stored.

Rubric and model answer

Task 1: plan the program (5 marks)

Model: user is the office clerk who needs grades and an average; input marks.csv with name,mark; output a grade for each pupil and the class average; functions load_marks(path), grade(mark) and average(marks).

Task 2: find the gaps (4 marks)

Model: boundaries such as 70, 69, 50 and 49; a mark of 0 and 100; bad input such as a blank line or text for a mark; a missing file; an empty file, where the average would divide by zero; a count check.

Task 3: work out the answers (3 marks)

Model: A, B and B. The average is (70 + 69 + 50) / 3 = 63.

Task 4: write the limits (4 marks)

Model: Limits: reads only marks.csv with columns name,mark; marks must be whole numbers 0 to 100; a bad row is skipped and counted; does not save results. Tests: boundaries 49, 50, 69 and 70, an empty file and a blank line passed; files over 10,000 rows not tested.

Marks so far: 0 of 16

Review with flashcards

Test yourself on this module with workplace flashcards and detailed answers.

Open the module flashcards