Closed-book retrieval: values and bindings (Days 04–05)
Agent-assisted practice: write your own prediction and observed output first; only then may you ask an AI agent to explain or review, and you must record that assistance in your evidence.
Prerequisites
Day 06 completed, including its independent check. If blocked, recover with Day 06 first; for values and bindings, revisit Days 04–05.
Learning Objective
Recall from memory how repr, type, and bool describe a value, and how rebinding differs from mutation, then confirm with Python on inputs you have not seen before (including empty and Unicode text).
Instructions
Spaced review: Days 04–05 were two to three days ago, so today you retrieve them before rereading anything. Pulling an idea back from memory, then checking it, makes it last longer than rereading notes. Nothing in this activity is new.
1. Close your notes. For each value in the first snippet, write the three columns you expect: repr, type name, and bool. Also predict the last line (len counts Unicode code points, not bytes).
2. Run the snippet and mark every row where your prediction differed.
3. Repeat with the binding snippet: predict both lines, then run it.
4. For each mismatch, write one sentence naming the rule you forgot and the day that teaches it (Day 04 for values, Day 05 for mutation and identity).
def show(value):
print(repr(value), type(value).__name__, bool(value))
show(0.0)
show("0.0")
show("")
show("猫")
show([""])
show(None)
print(len("猫"), len("café"))
a = ["猫"]
b = a
a.append("犬")
print(b, a is b)
c = ["猫"]
d = c
c = c + ["犬"]
print(d, c is d)
Practice & Prediction Log
Record a prediction table with one row per value (0.0, "0.0", "", "猫", [""], None) and the columns repr / type / bool, plus your prediction for len("猫") and len("café"). Then predict the two lines printed by the binding snippet and explain which name was mutated and which was rebound.
The empty string is the only false string; any non-empty string, even "0.0" or a single space, is true. A list that contains an empty string is not empty. append changes the existing list object that both names refer to; c = c + [...] builds a new list and moves only the name c.
Exact output of the first snippet:
0.0 float False
'0.0' str True
'' str False
'猫' str True
[''] list True
None NoneType False
1 4
Exact output of the binding snippet:
['猫', '犬'] True
['猫'] False
Why: 0.0 and None are false, and "" is the empty string, so it is false; every non-empty string is true, including "0.0". [""] is a list with one element, so it is true. "猫" is one code point and "café" is four. In the binding snippet, a and b name the same list, so append is visible through b and a is b stays True. c + ["犬"] creates a new list; d still names the original ["猫"], so c is d is False.
Your written predictions exist before execution, cover all six values plus the two len results and both binding lines, and every mismatch has a one-sentence rule and a recovery day (Day 04 or Day 05).
Authoritative Source Resources & Provenance
The Python Tutorial: More Control Flow Tools
Relevant Section / Range: Sections 4.2–4.10 (for, range, defining functions); data structures are in Chapter 5 of the same tutorial
Verified Version & Date: Python 3.12 documentation; verified 2026-10-30
Primary reference for Python iteration, functions, and containers.
Study Days 01-06 Python expression and filesystem fundamentals
The lesson explains all required behavior locally and can be completed offline.
Compared Candidate Sources & Selection Analysis (2)
Grammar-level definition of the same constructs; the tutorial chapter was selected for its guided pacing.
Lecture-paced coverage of the same control flow; deferred because the curriculum already drives the concepts through terminal drills.