Week 3: For Loops, Lists, and Tuples

214 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 3: For Loops, Lists, and Tuples > **Course:** Jan 2026 - Python > **Focus:** Iteration over sequences, collection behavior, and nested repetition. --- ## 1.

Visual strip

Relevant recall pieces for this note

Open gallery

Week 3: For Loops, Lists, and Tuples

Course: Jan 2026 - Python Focus: Iteration over sequences, collection behavior, and nested repetition.

1. Core idea

Week 3 shifts from "repeat until done" to "repeat over a sequence."

What to remember

  • for iterates over items, not conditions.
  • range(n) produces 0 to n - 1.
  • Lists are mutable.
  • Tuples are immutable.
  • Nested loops multiply work, so count them carefully.

2. Common traps

  • break stops the loop immediately.
  • continue skips the rest of the current turn.
  • A list slice returns a list.
  • A tuple cannot be edited in place.
  • Off-by-one errors often hide in range(start, stop).

3. Speedrun pattern

When you see a Week 3 question, ask:
  1. Is this counting iterations or reading a collection?
  2. Does the code mutate the list?
  3. Is the question about the whole grid, or one cell at a time?

4. Micro revision

  • Use for for fixed iteration.
  • Use while for unknown iteration count.
  • Use lists for changeable collections.
  • Use tuples for fixed collections and stable keys.

Assignment anchor

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.