Nested get with dotted path
Implement a function that safely retrieves a value from a deeply nested dictionary using a dot-separated path, returning a default if any key is missing.
Top k keys by count
Given a dictionary mapping keys to counts, return the top k keys with the highest counts, breaking ties alphabetically.
Replace keys with a mapping
Write a function that renames keys in a dictionary according to a mapping, with duplicate handling.
Two Sum with Dict
Implement the classic Two Sum problem: return indices of two numbers that add up to a target using a dict.
Sort by frequency
Sort a list by element frequency descending, with ties broken by order of first occurrence.
Pair with difference K
Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.
Count Pairs with Sum
Implement a function that counts the number of distinct pairs in a list summing to a target.
Group by Department
Implement a function that groups a list of employee dictionaries by department, returning a dictionary keyed by department with lists of employee dictionaries.
Pivot sales by product
Write a function that pivots sales records into a dictionary keyed by product with monthly totals.
Stack class
Implement a Stack class with push, pop, peek, is_empty, and size.
Event emitter basics
Implement an EventEmitter class with subscribe/emit/unsubscribe functionality.
Rectangle class
Implement a Rectangle class with properties, methods, and special methods for basic geometry and comparison.
Queue class (list-based)
Implement a Queue class with enqueue, dequeue, peek, is_empty, and is_full methods using a list.
Abstract Base Class
Create an abstract Shape class and implement Rectangle and Circle subclasses with area and perimeter.
Reentrant Lock Manager
Implement a ReentrantLock class with acquire, release, locked, owner, and helper functions that test thread-safety with real threads.
Design Twitter Feed
Implement a Twitter class with postTweet, getNewsFeed, follow, and unfollow methods.
Deck of Cards Class
Implement a Deck class representing a standard 52-card deck with shuffle, deal, and len support.
Dataclass with slots
Implement a slotted frozen dataclass representing a 2D point with total ordering.
Playing card class
Design a PlayingCard class with suit, rank, color, and equality/comparison magic methods.
Count pairs with given difference
Count how many unordered pairs in a list have a given absolute difference using an efficient approach.
Previous Smaller Element
Find the nearest previous index with a smaller value for every element in an array.
Union Find Class
Implement a UnionFind class with find and union operations supporting path compression and union by size.
Basic Calculator II
Evaluate a basic arithmetic expression with +, -, *, / following operator precedence.
Online Stock Span
Implement StockSpanner.next(price) that returns the maximum number of consecutive days (including today) with price <= current price.
Showing 49–72 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.