Print Args Decorator
Write a decorator that prints function name and arguments, then returns the original result.
Log Calls Decorator
Create a decorator that prints call details and returns the original result.
Safe divide function
Implement safe_divide that returns None on ZeroDivisionError and TypeError.
Key error handler
Implement a safe dictionary access function that returns a default value on missing keys.
Parse JSON safely
Implement a robust JSON string parser that returns a fallback on invalid input.
Exit handler registration
Write a function that registers a callback to run at interpreter exit and returns True on success.
Nth Triangular Number
Implement a function that returns the nth triangular number efficiently.
Integer Square Root Floor
Implement a function that returns the greatest integer whose square is ≤ n, using only integer operations.
Catalan number
Implement a function that returns the nth Catalan number using dynamic programming.
Perfect Number Check
Write a function that returns True if a number is perfect, i.e., equal to the sum of its proper divisors.
Happy number check
Implement a function that returns True if a number is happy, False otherwise.
Triangular Number
Implement a function that returns the nth triangular number using the closed-form formula.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Integer Square Root
Implement integer_sqrt(n) that returns the largest integer whose square is ≤ n.
Dot Product of Vectors
Implement a function that returns the dot product of two numeric vectors.
Modular Inverse
Implement a function that returns the modular inverse of a modulo m, or -1 if it does not exist.
Deficient Number Check
Write is_deficient(n) that returns True if the sum of proper divisors is less than n.
Stars and Bars Count
Implement stars_and_bars_count(n, k) which returns the number of ways to put n identical items into k distinct bins, with bins allowed to be empty.
Count Set Bits
Implement a function that returns the number of set bits (1s) in the binary representation of a non-negative integer.
Check Power of Two Bits
Implement is_power_of_two(n) that returns True if n is a power of two and False otherwise.
Find Rightmost Set Bit
Implement a function that returns the 1-indexed position of the rightmost set bit of a positive integer, or 0 if none.
Set kth Bit
Implement a function that sets the kth bit (0-indexed) of a non-negative integer to 1 and returns the result.
Clear Rightmost Set Bit
Write a function clear_rightmost_set_bit that accepts a non-negative integer and returns the integer with its rightmost set bit cleared.
Toggle kth Bit
Implement a function that toggles the kth bit of a non-negative integer (0-indexed from the least significant bit) and returns the new integer.
Showing 73–96 of 127 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.