Week 16 — Lecture Outline · Final Review (Cumulative, Weeks 1–15)
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Purpose: a guided cumulative review of all 8 objectives before the Final — not new content. Re-walk each objective's big idea, its exact syntax, and its classic bug, predicting and running every snippet.
Meeting pattern: 2 studio sessions × 75 min. Session 1 = Objectives 1–5 (first half); Session 2 = Objectives 6–8 (second half) + exam logistics.
Every output below was produced by running the code in Python. Run them live; have the room predict first.
Segment 1 — How to Review (8 min)
The Final is mostly predict-the-output and debugging across the whole course. Best prep: predict, then run. Hand out the classic-bug checklist (Segment 8). Tell students to take the Practice Final first.
Segment 2 — Objectives 1–2: Basics, Variables, Expressions, Strings (20 min)
- Precedence:
3 + 4 * 2→ run-verified 11. Errors:SyntaxErrorvsNameErrorvsFileNotFoundError. /→ float (8 / 4→ 2.0);%remainder (13 % 4→ 1).int("7") + 3→ 10;"3" + "4"→ 34.input()returns a string; slicing stop is exclusive ("COMPUTER"[0:4]→ COMP).
Segment 3 — Objective 3–4: Conditionals & Loops (22 min)
not (5 < 3)→ run-verified True.if/elif/elseruns the first true branch (forn = 0, prints zero).=vs==.foraccumulatorrange(1, 5)→ sum 10;list(range(2, 8, 2))→ [2, 4, 6]. Nested loops multiply (3×2 → 6 prints). Off-by-one + infinite-loop bugs.
Segment 4 — Objective 5: Functions (16 min) · Session 1 closes
def triple(n): return n * 3→triple(4)→ 12. Noreturn→ None. Local scope →NameErroroutside.
Segment 5 — Objective 6: Collections (22 min) · Session 2 opens
- Lists: indexing,
.append(), and aliasing —a = [1,2]; b = a; b.append(3); print(a)→ run-verified [1, 2, 3]. - Dicts:
ages["Lin"]looks up a value; a missing key is aKeyError. Sets dedup:len({1,2,2,3,3,3})→ 3. Tuples are immutable (TypeErroron assignment).
Segment 6 — Objective 7: Strings, Files & Exceptions (20 min)
- String methods return NEW strings (immutable):
"hello".upper()→ HELLO;s.upper()alone doesn't changes..split(",")→ a list. - Files:
with open(...);try/except.int("x")→ValueError(caught → "caught"); a missing key →KeyError; a missing file →FileNotFoundError.
Segment 7 — Objective 8: Algorithms, Recursion & OOP (20 min)
- Big-O: linear search O(n), binary search O(log n) (needs sorted), selection sort O(n²).
- Recursion:
fact(4)→ run-verified 24 (base casen == 0); no base case →RecursionError. - OOP:
Dog('Rex').speak()→ Rex barks; forgettingself.→AttributeError.
Segment 8 — The Classic-Bug Checklist + Exam Logistics (16 min) · Session 2 closes
Print this: = vs == · exclusive range stop · / → float · "2"+"3" is "23" · no return → None · list aliasing (b = a) · missing self. → AttributeError · binary search needs sorted · every recursion needs a base case · input() returns a string.
Logistics: Final opens Mon Dec 14, due Fri Dec 18, 25 items, 100 points, no AI, one attempt. Take the Practice Final first.
Scope flag
This review is cumulative over all 8 objectives (Weeks 1–15). No new content. Every output shown was produced by running the code.
~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com