Educational Cards
Learn from video content, text, and interactive tasks
Filters
Network-shaped failures without fragile parsing
HTTP layers deliver bytes on the wire; JSON parsers want text ; base64 wraps binary inside ASCII....
Whitelist vs blacklist at simple parsers
A whitelist allows only known-good characters ( [a-z0-9_-] for slugs). A blacklist bans known-bad...
Exceptions signal contract violations cleanly
Return codes like -1 or sentinel strings collide with legitimate data: a temperature of -1 might be...
Normalising calculators and tokens
Human-entered expressions mix Unicode spaces, x for multiplication, and locale-specific decimals....
Assertions vs validator contracts
assert condition documents internal invariants you believe should already hold: “this tensor is 2-D...
Space complexity: recursion stack vs buffers
Auxiliary space counts extra memory beyond the input itself: recursion stack frames, temporary...
Amortisation snapshot: list append
CPython list is a dynamic array : appending usually takes O(1) time, but occasionally triggers a...
Experiments spanning input sizes
Asymptotic claims are about limits; empirical curves show where limits matter for your hardware and...
Checking sorted-order invariants cheaply
Monotonicity checks appear in time-series QA (“is this slice non-decreasing?”), in merge routines...
Linear scans vs logarithmic hunts
Searching for a value in an unsorted Python list requires a linear scan in the worst case—you might...
Empirical timings with perf_counter
time.perf_counter() returns a float timestamp from a monotonic clock suitable for deltas : subtract...
Nested loops imply quadratic explosions
A double loop over indices (i, j) with i, j < n runs Θ(n²) iterations if the inner body is O(1)....