Collatz steps
Count how many steps the Collatz sequence takes to reach 1 from n.
Factorial (iterative)
Compute n! iteratively without recursion.
Power of two?
Return True if n is an exact power of 2.
GCD via Euclid
Compute the greatest common divisor of two positive integers.
Prime checker
Return True if n is a prime number.
Compound interest
Return the future balance after compound interest, rounded to two decimals.
Absolute Difference of Two Integers
Compute the absolute difference between two integers, regardless of order.
Sum from 1 to n
Write a function that returns the sum of all integers from 1 to n (inclusive).
Circle Circumference Calculator
Implement a function that computes the circumference of a circle from its radius using the formula 2πr.
Digit Count
Count the number of digits in an integer using arithmetic, without string conversion.
Find Missing Number
Given a list of n distinct integers from 0..n with one missing, return the missing number.
Hexagonal Number
Write a function to check if a positive integer is a hexagonal number.
Count trailing zeros
Write a function that counts the number of trailing zeros in the decimal representation of a positive integer.
Zigzag string conversion
Encode a string in zigzag order across numRows rows, then read row by row.
Find Missing Number 1 to n
Given a list containing n-1 distinct integers from 1 to n, find the missing number without using extra space.
Product of All Except Zeros Handling
Given a list of integers, return a list where each element is the product of all other elements, handling zeros correctly.
Difference of Consecutive Elements
Given a list of numbers, return a new list where each element is the difference between consecutive elements.
Two Missing Numbers
Given a list of n-2 unique integers from 1 to n, find the two missing numbers efficiently.
Pascal Triangle Row
Given a non-negative integer n, return the nth row of Pascal's triangle as a list of integers.
2D Vector dataclass
Implement a Vector2D dataclass with +, -, scalar *, dot product, and magnitude.
Nth Triangular Number
Implement a function that returns the nth triangular number efficiently.
Clamp and round to nearest ten
Clamp a number between given bounds and round the result to the nearest ten with halves away from zero.
Integer Square Root Floor
Implement a function that returns the greatest integer whose square is ≤ n, using only integer operations.
Power set size
Compute the size of the power set of a given sequence.
Polynomial evaluator
Implement a polynomial evaluator that computes the value of a polynomial given as a list of coefficients.
Catalan number
Implement a function that returns the nth Catalan number using dynamic programming.
Stirling number
Implement a function to compute Stirling numbers of the second kind S(n,k).
Euler Totient Function
Implement Euler's totient function φ(n) for positive integers.
Prime Factorization
Return a sorted list of prime factors of a positive integer, including repeated factors.
Count divisors
Compute the number of positive divisors of a given integer using its prime factorization.
Sum of divisors
Given an integer n, return the sum of all its positive divisors.
Perfect Number Check
Write a function that returns True if a number is perfect, i.e., equal to the sum of its proper divisors.
Abundant Number Check
Implement a function to check whether a given integer is abundant: sum of proper divisors exceeds the number.
Amicable Numbers Check
Write a function that checks if two numbers are an amicable pair by comparing sums of proper divisors.
Happy number check
Implement a function that returns True if a number is happy, False otherwise.
Harshad Number Check
Write a function that checks if a number is a Harshad (or Niven) number.
Triangular Number
Implement a function that returns the nth triangular number using the closed-form formula.
Pentagonal Number
Given a positive integer n, return the nth pentagonal number using the formula P(n) = n(3n - 1)/2.
Lucas Sequence
Implement a function to compute the n-th Lucas number using iteration or recursion with memoization.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Missing Number XOR
Given a list of n distinct numbers from 0 to n with one missing, use XOR to find and return the missing number.
Bell number
Implement a function to compute the Bell number B(n) using dynamic programming.
Perfect Squares Sum
Given a positive integer n, return the least number of perfect squares (e.g., 1, 4, 9, 16, ...) that sum to n.
Integer Break Product
Given a positive integer n, break it into at least two positive integers that sum to n and maximize their product.
Days in month
Write a function that returns the number of days in a given month and year, correctly handling leap years.
Showing 45 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.