Python interview warm-up

Mutable defaults, closures, generators, decorators and dataclasses — plus classic problems.

  1. Mutable Default Arguments Default values are evaluated once, at definition time. Easy Most asked Python
  2. Late-Binding Closures Lambdas look up variables when called, not when created. Medium Python
  3. List Multiplication Shares Rows `[[0] * 3] * 3` creates three references to one row. Easy Python
  4. Lazy chunked() Generator Yield fixed-size lists from any iterable — lazily, so it works on infinite streams. Easy Python
  5. Decorator with Arguments: @retry Write a parameterised decorator that retries selected exceptions and preserves metadata. Medium Python
  6. Immutable Money Value Object (dataclasses) Use a frozen, ordered dataclass with __add__ and __str__ for money. Medium Python
  7. Group Anagrams Group words that are anagrams of each other. Medium Most asked All 5 languages
  8. Top Endpoints from Access Logs Parse web-server log lines and return the most requested paths. Medium All 5 languages
  9. LRU Cache A fixed-capacity cache that evicts the least recently used key, with O(1) get and put. Medium Most asked All 5 languages

← All coding problems