The Life Starter
0 of 6 complete0%
Course Library · Lesson 6 of 6
Digital · Guided lesson

Finish a small, explainable Python tool

About 42 minutes · 7 reading + 35 practice and checks
Time includes reading, practice, and questions. Extra videos or further study are optional.
See this course’s project requirements

Build a supply-kit calculator, check it with five test cases, and explain how to use it. Combine the work you complete across the six lessons.

Keep your working files in your own notebook or software. Save a private description, checklist, and work link in My Proof.

What to include

  • State numeric input rules and invalid-input behavior.
  • Include a working function, conditional guard and loop over a list.
  • Show original, changed, empty and invalid-input reasoning.
  • Retain five explicit tests with expected results.
  • Provide complete code, expected output and a handoff note.

Review and revise

Use these criteria to check your work and choose what to improve.

  • Correctness: valid quantities produce independently checked kit counts.
  • Reasoning: traces explain assignment, branches and repeated work.
  • Testing: normal and invalid cases support the claimed behavior.
  • Handoff: supported inputs and limitations are clear.
Open the full course project
Want more background?
Before you begin

The idea in everyday life

Your final tool summarizes a few workshop inventories. Its value is not the number of lines it contains but whether someone can understand the input, predict the output and recognize unsupported cases. You already have the function, loop reasoning and tests. This lesson joins those outputs without adding accounts, external packages or file-system access.

The idea

A finished small program includes its operating instructions and known limits.

Try it

One step at a time.

Use the sample or information you have permission to use. Keep your work as you go. You can pause between steps.

  1. 1

    Copy the guarded complete_kits function from the previous lesson into a single program. Preserve its input contract, including the restriction to whole-number quantities, in a short comment or accompanying note.

  2. 2

    Add the sample inventory list [23,12,0]. Use a loop to call the function for each count with four supplies per kit. Print the input and result together so their relationship stays visible.

  3. 3

    Add a separate invalid-input demonstration such as complete_kits(8,0). Label None as invalid configuration in your explanation rather than reporting it as zero kits.

  4. 4

    Reuse the five tests from your debugging record. Trace the complete program once and, if an available Python 3 environment is permitted, run it. Paper completion includes an exact expected-output transcript.

  5. 5

    Write a handoff note explaining which list and per-kit value may be changed, how to check outputs, and which inputs remain unsupported. Finish with one proposed improvement and the test it would need.

Example

See how it works.

Fictional example: the completed workshop summary is self-contained.

python
def complete_kits(supplies, per_kit):
    if supplies < 0 or per_kit <= 0:
        return None
    return supplies // per_kit

inventories = [23, 12, 0]
for amount in inventories:
    print(amount, "supplies ->", complete_kits(amount, 4), "kits")
print("Invalid example:", complete_kits(8, 0))

The three inventory lines report 5, 3 and 0 kits. The final line reports None. This demonstration makes the invalid case visible without changing the valid inventory list. The handoff says that the program does not accept text such as "many" and does not reserve stock across different sessions.

Check your work

Did you cover these?

  • Complete program contains definition and calls.
  • All five previous tests are retained.
  • Handoff explains None and whole-number input limits.
Your work

What to finish

One complete program, expected-output transcript, reused tests and a short handoff note.

Common mistake

Watch for this

Claiming a classroom example is production-ready or hiding input assumptions.

How can I tell I understand it?

Another reader can change one supported input and predict the new output.

Try 3 questions

Quick knowledge check

Answer all 3 questions. Get at least 2 right and the lesson completes automatically.

Not yet passed

You’ll get an explanation for each answer. Signed in? Your results save to your account.

1Change inventories to [8,15] with four supplies per kit. What counts should appear?
2The current guarded function assumes numeric whole-number inputs. A reader wants to enter the string "twelve" as supplies. What should the handoff say?
3A reader should be able to change a supported inventory and check the result. Which handoff package provides the necessary evidence and limits?
0 of 3 answeredApply the lesson to a short question, then review the explanation.
6
Finish this lesson

Pass the check. We’ll save the progress.

Answer all 3 questions above and get at least 2 right. You can review the explanations and try again.

Go to the knowledge check
Tools, templates, and lesson sources

Tools and templates

Tools open in a new tab so you can keep your place here.

Sources and further reading

Explore the references behind this lesson.

Harvard CS50 — Introduction to Programming with Python
Source & access notes · checked 2026-09-10

Opened the course overview and Week 0 page; verified coverage of variables, conditionals, loops, exceptions and testing. Optional deeper study, not a source of copied exercises.

Access: OpenCourseWare is free to read/watch. External assignment submission requires an edX account; optional verified/professional certificates use separate enrollment and may cost money. No Harvard affiliation or credit is offered here.

Reuse: Linked for reference. Examples, activities and assessments here are original; free access alone does not grant permission to reuse source text or branding.

Python documentation — More Control Flow Tools
Source & access notes · checked 2026-09-10

Opened official tutorial covering if, for, range and function definitions; examples use stable Python 3 syntax.

Access: Free public reading; no account or certificate is required for this Life Starter course.

Reuse: Linked for reference. Examples, activities and assessments here are original; free access alone does not grant permission to reuse source text or branding.

Report a problem with this lesson

Tell us what went wrong. Please leave out personal information and private project contents.

No sign-in needed.