Context manager from generator
Implement a context manager that yields a value and ensures cleanup, using a generator-based approach.
Benchmark decorator
Implement a benchmarking decorator that records call count and timing statistics per function.
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.
Validate Email Regex
Implement a function that validates email addresses using regex with specific rules.
Match Credit Card Pattern
Write a function that validates a credit card number string against a set of formatting rules.
Smith Number Check
Write a function to check if a number is a Smith number by comparing digit sums of the number and its prime factorization.
Zeller Congruence Weekday
Implement a function that returns the weekday name for a given date using Zeller's congruence.
Extended Euclidean Algorithm
Implement the extended Euclidean algorithm to return (gcd, x, y) such that ax + by = gcd(a, b).
Polynomial Fit Coefficients
Implement a function that returns the coefficients of the best-fit quadratic polynomial for given points.
Multinomial coefficient
Write a function to compute the multinomial coefficient efficiently for given nonnegative counts.
Correlation Coefficient
Write a pure-Python function that computes the Pearson correlation coefficient between two lists of numbers.
Binomial Coefficient
Implement a function to compute binomial coefficients modulo 10^9+7 for n up to 10^5.
Bitwise AND of a Range
Given a range [a, b], return the bitwise AND of all integers in that inclusive range without iterating over all numbers.
Divide using shifts
Implement division of two integers using only bit shifts and arithmetic, without using division or modulo operators.
Bit Mask Permissions
Implement helper functions to compose bit masks and check permission bits using bitwise operators.
Maximum XOR Pair
Implement max_xor_pair(nums) that returns the maximum XOR value obtainable by pairing any two numbers in the given list.
Levenshtein Distance
Implement the classic Levenshtein distance algorithm to measure string similarity.
Kadane Variant: Maximum Product Subarray
Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.
Max Profit from Selling Twice
Compute the maximum profit that can be achieved by completing at most two buy-sell transactions on a given price array.
Bell number
Implement a function to compute the Bell number B(n) using dynamic programming.
House Robber Circular
Solve the House Robber problem with houses arranged in a circle.
Unique Paths with Obstacles
Given a 2D grid with obstacles, count the unique paths from top-left to bottom-right moving only down or right.
Maximal square
Given a 2D binary matrix of 0s and 1s, compute the area of the largest square containing only 1s.
Showing 97–120 of 323 challenges · medium
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.