Educational Cards

Learn from video content, text, and interactive tasks

Filters
Clear
JIT accelerators caveats

Numba (and similar tools) compile restricted Python/NumPy loops to machine code. They shine on...

Intermediate Accelerating numerics & developer hygiene
Type hints aiding maintainability—not runtime magic

PEP 484 annotations document expected types for humans and for static checkers ( mypy , pyright ,...

Beginner Accelerating numerics & developer hygiene
Exceptions signal contract violations cleanly

Return codes like -1 or sentinel strings collide with legitimate data: a temperature of -1 might be...

Beginner Defensive APIs: validation, sanitization & exceptions
Normalising calculators and tokens

Human-entered expressions mix Unicode spaces, x for multiplication, and locale-specific decimals....

Beginner Defensive APIs: validation, sanitization & exceptions
Structured token ladders

Unary-free arithmetic ladders alternate operand, operator, operand, … with odd length: [10, '+', 2,...

Beginner Defensive APIs: validation, sanitization & exceptions
Guard clauses before brittle arithmetic

Division, logarithms, and normalisations explode on zero or negative values in the wrong domain....

Beginner Defensive APIs: validation, sanitization & exceptions
Network-shaped failures without fragile parsing

HTTP layers deliver bytes on the wire; JSON parsers want text ; base64 wraps binary inside ASCII....

Intermediate Defensive APIs: validation, sanitization & exceptions
Whitelist vs blacklist at simple parsers

A whitelist allows only known-good characters ( [a-z0-9_-] for slugs). A blacklist bans known-bad...

Beginner Defensive APIs: validation, sanitization & exceptions
Static methods versus instance misuse

@staticmethod functions live in class namespace but do not receive self or cls . They are plain...

Intermediate Defensive APIs: validation, sanitization & exceptions
Assertions vs validator contracts

assert condition documents internal invariants you believe should already hold: “this tensor is 2-D...

Intermediate Defensive APIs: validation, sanitization & exceptions
Empirical timings with perf_counter

time.perf_counter() returns a float timestamp from a monotonic clock suitable for deltas : subtract...

Beginner Asymptotics & empirical timing
Big-O: describe growth, not microseconds

Big-O notation answers: “If I double the training set / feature dimension / graph size, what...

Beginner Asymptotics & empirical timing