Flatten Nested List Iterator
Implement a class that iterates over all integers in a nested list structure in depth-first order.
Iterator protocol class
Implement a class that follows the iterator protocol and yields squared numbers up to a given limit.
Batch Iterator
Implement a generator that yields batches of a given size from any iterable, including the final partial batch.
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.
Close generator early
Wrap any iterable in a generator that tracks yielded items and supports close() correctly.
Once Decorator: Run a Function Only Once
Implement a decorator that caches and returns the result of the first call for subsequent calls.
Timing Decorator
Implement a decorator that prints the execution time of a function.
Context Manager Class
Implement a context manager class that measures execution time and sets duration, with None if an exception occurred.
Print Args Decorator
Write a decorator that prints function name and arguments, then returns the original result.
File Open Context Manager
Create a class that acts as a context manager for opening a virtual file in memory.
Timer Context Manager
Implement a context manager that measures execution time of a with block and stores it.
Suppress stderr manager
Implement a context manager that suppresses all output written to stderr during its block.
Context Decorator Dual
Implement a timing decorator and a context manager that both record elapsed time in seconds.
Count calls decorator
Implement a decorator that counts and reports how many times the wrapped function is called.
Log Calls Decorator
Create a decorator that prints call details and returns the original result.
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.
Safe divide function
Implement safe_divide that returns None on ZeroDivisionError and TypeError.
Safe int parser
Implement safe_parse_int that converts a string to an int, returning a default value on failure.
Safe Float Parser
Write a function that safely converts a string to a float, returning None for invalid inputs.
Divide with zero check
Write a function that safely divides two numbers, catching division by zero.
Key error handler
Implement a safe dictionary access function that returns a default value on missing keys.
Showing 337–360 of 556 challenges · easy
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.