Skip to content
Problem of the day: What goes on sys.path first

Python practice problems

Python
Difficulty:
Category:
Tag:

Showing 50 of 195

Status Title Difficulty
abc.ABC: abstract properties and classmethods, in the right order Easy
Accept broad, return narrow: group_by and merge_counts Medium
Accidental quadratics: an index-backed join and a streaming top-k Medium
accumulate and pairwise: max drawdown in one pass Easy
aclosing: release the connection on break, error and cancellation Hard
A Fetcher Protocol three implementations can satisfy Medium
A @final rate limiter Easy
A generic Result[T, E] Medium
__all__, re-export rules, and the accidental public API Medium
Amortise cents without mixing up the units Medium
Annotated: metadata the type checker deliberately ignores Medium
A rate limiter with an injected clock Medium
A rate limiter you can test without sleeping Hard
A recursive Json alias, depth and flatten Medium
A registry that does not prevent collection Medium
asdict() and astuple(): the deep-copy tax Hard
assert_never and the event that was never handled Medium
asyncify: a ParamSpec wrapper that does not block the loop Medium
Async iterators: the paginator you can actually close Medium
A typed factory fixture Hard
Auditing a library for import-time side effects Hard
Auditing the Any surface of a module Medium
BackgroundTasks: strong references, and a drain that raises Medium
Bare except, blind except Exception, and where to catch Medium
Batched async stream: never yield inside a cancel scope Hard
batched: page a stream, and validate before you yield Easy
BoundedBuffer: a blocking queue from one Condition Medium
Bounded concurrency and backpressure Hard
BoundedCounter: check-then-act under 64 threads Medium
Bounds versus constraints: clamp and dedupe Hard
cached_property: compute once, release with the instance, invalidate on demand Medium
cache: memoised edit distance behind a validated wrapper Medium
Callback protocols: closing the Callable[..., Any] hole Medium
Capstone: a fully typed, cancellable, observable async worker pool Hard
Capstone: an immutable domain model that survives review Hard
Capstone: a typed, cancellable, observable worker pool Hard
Capstone: break the monolith, then enforce the layering Hard
Capstone: five defects, and which tool would have found each one Hard
Capstone: the upload that cannot be misused Hard
ChainMap: resolve config and keep the provenance Medium
Class patterns, __match_args__ and an expression simplifier Medium
ClassVar, field(), and the counter that must reset Easy
Coerce to int at an untyped boundary Medium
contextmanager: temporarily patch an attribute, and put it back Medium
Converters and validate-on-assignment: what attrs buys you Medium
Counter: top n-grams with deterministic ties Easy
Dataclasses: slots, frozen, order Easy
@dataclass is a code generator: what it emits Easy
dataclass_transform (PEP 681): making your own decorator type-checkable Hard
datetime: reject naive input, and find the next local wall clock Hard