Delete Old Records
Filter a list of records by removing those with a date older than a given cutoff date.
Argsort Indices
Implement a function that returns the indices that would sort a list of integers, with ties broken by original order.
Design Browser History
Implement a BrowserHistory class that supports visit, back, and forward navigation with step counts.
Design Skip List Lite
Implement a simplified skip list supporting insert, search, and delete with O(log n) average complexity.
Employees earning more than manager
Given employee records with manager IDs, find those who earn more than their direct manager.
2D Vector dataclass
Implement a Vector2D dataclass with +, -, scalar *, dot product, and magnitude.
Data pipeline
Implement a Pipeline class supporting pipe chaining with the | operator.
Default Argument Trap
Implement a function that safely accumulates items without the classic mutable default argument bug.
TypeVar bounded generic
Learn to use TypeVar with bounds to write type-safe generic functions in Python.
Context Variable Scope
Implement a context manager that temporarily changes a global variable and restores it afterwards, even if an exception occurs.
Range-like generator
Implement a custom generator that yields numbers like Python's range but with flexible bounds.
File Line Reader Generator
Implement a generator function that reads a file-like object and yields each non-empty line without loading the whole file into memory.
Cartesian Product Generator
Implement a generator function that yields the Cartesian product of multiple input iterables without precomputing all results.
Zip Longest Fill
Create an iterator that yields lists from multiple iterables, padding with a fill value when lengths differ.
Graph DFS Generator
Implement a generator function that performs a depth-first traversal of a graph without recursion.
Memoize with TTL
Implement a decorator that caches function results for a limited time, returning cached values within the TTL and recomputing after expiry.
Context Manager Class
Implement a context manager class that measures execution time and sets duration, with None if an exception occurred.
Timer Context Manager
Implement a context manager that measures execution time of a with block and stores it.
Lock Context Manager
Implement a Lock class with acquire/release and context manager support.
Class-based decorator with call validation
Build a class-based decorator that validates a single argument's type and logs successful invocation.
Safe Integer from String
Implement safe_int that converts a string to an integer, returning a default value on any failure, with support for an optional base.
Divide with zero check
Write a function that safely divides two numbers, catching division by zero.
Resource Cleanup Manager
Implement a context manager that tracks and releases resources reliably, and can report cleanup actions.
Suppress Specific Exceptions
Implement a custom context manager that suppresses specified exception types within its block.
Showing 73–96 of 191 challenges
Guide: free Python coding challenges
Practice Python by solving problems
PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.
How to use the arena
- Pick a category — basics, algorithms, strings, and more
- Open a challenge, read the statement, and edit the starter code
- Run tests, fix failures, then try a related quiz or tutorial lesson
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.