First composed campus program

Attendance: a list of marks, a pass rule, a count, a line a clerk can read. Nothing new — names, lists, if, loop, function — in one file-shaped program.

Campus lab board

Utilisation is used ÷ seats.

You will be able to

  • Compose lists, if, loop and a function
  • Print a clerk-readable line
  • Keep the pass rule in one function

Nothing new — one file-shaped program

Attendance: a list of marks, a pass threshold, a count of keepers, a line a clerk can read. This is the ‘first program’ energy from a language tutorial: names, a loop, a decision, output. The professional twist is a named function so a test can call it tomorrow.

If the principal changes 40 to 35, one function changes. The print at the edge formats. That split is the whole foundation, used at once.

Words that matter

Compose
Use skills together, not a new syntax.
Threshold
A config number — pass mark — not scattered 40s.

Common mistakes

Avoid: Copying >= 40 into the loop, the print and a WhatsApp.

Do this: passed(mark, cutoff) in one place.

Run it step by step

Each box is a real program. Press Run, change a number, Run again — the output must follow your code.

1. Step 1 — the rule

41 is a pass at cutoff 40.

Python sandboxlesson://workspace
console

Edit the example, press Run, then Build if you want a compile check.

build

Press Build to compile.

2. Step 2 — count keepers

Source stays. Count is for the clerk.

Python sandboxlesson://workspace
console

Edit the example, press Run, then Build if you want a compile check.

build

Press Build to compile.

Example program — Clerk line

Units on the label. Rule in the function.

Python sandboxlesson://workspace
console

Edit the example, press Run, then Build if you want a compile check.

build

Press Build to compile.

Your turn — Count passes

marks = [32, 41, 55]. Count values >= 40. Print so 2 appears.

Python sandboxlesson://workspace
console

Edit the example, press Run, then Build if you want a compile check.

build

Press Build to compile.

Self-assessment

Check your understanding before you mark the lesson complete.

1. A pass cutoff should live in…
2. This capstone of foundation is mainly…

Progress is stored in a browser cookie on this device.