Even or odd?
Return 'even' or 'odd' for an integer.
Sum of digits
Return the sum of all decimal digits of a non-negative integer.
GCD via Euclid
Compute the greatest common divisor of two positive integers.
Absolute Difference of Two Integers
Compute the absolute difference between two integers, regardless of order.
Grade from Score
Write a function that maps a numeric score to its letter grade using standard grading thresholds.
Min of three numbers
Write a function that returns the minimum of three integers.
Integer division and remainder
Write a function that performs integer division and returns both quotient and remainder.
Sum numbers from 1 to n
Implement a function that computes the sum of all integers from 1 to n.
Seconds to Hours Minutes Seconds
Convert total seconds into a zero-padded HH:MM:SS format.
Digit count of an integer
Given an integer, return the number of digits it has, handling negatives and zero correctly.
Count Multiples in a Range
Given a start, end, and divisor, count how many integers in [start, end] are divisible by the divisor.
Sum from 1 to n
Write a function that returns the sum of all integers from 1 to n (inclusive).
Count Positives
Count the positive numbers in a list of integers.
Find Minimum Value
Write a function that returns the minimum integer from a given list.
Round to nearest ten
Write a function that rounds any integer to the nearest multiple of ten.
Modulo Remainder
Implement a function that returns the remainder of a divided by b without using the modulo operator.
Digit Count
Count the number of digits in an integer using arithmetic, without string conversion.
Last Digit Extractor
Write a function that returns the last digit of a non-negative integer using the modulo operator.
Find Missing Number
Given a list of n distinct integers from 0..n with one missing, return the missing number.
Map, Filter, Reduce
Implement three functions using map, filter, and reduce to manipulate a list of integers.
Palindromic Number Check
Write a function to check if a given integer is a palindrome.
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.
Count Leading Zeros
Write a function that returns the number of leading zeros in a list of integers.
Repeat each character n times
Given a string s and an integer n, return a new string where each character of s is repeated n times consecutively.
Extract Digits Only
Given a string that may contain letters, symbols, and whitespace, extract all digits in order and return them as an integer.
Roman to Integer
Convert a valid Roman numeral string to an integer using standard rules.
Strip Leading Zeros
Write a function that strips leading zeros from a string representing a non-negative integer.
Find all numbers in text
Write a function that extracts all standalone integers from a text string using regular expressions.
Running Product of Integers
Given a list of integers, return a new list where each element at index i is the product of all elements from index 0 to i.
Second Largest Unique Value
Return the second largest distinct integer from a list, or None if it doesn't exist.
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.
Wave sort array
Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.
Counting Sort
Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.
Keys Sorted by Value Descending
Given a dictionary mapping strings to integers, return a list of keys sorted by value descending, and when values tie, alphabetically ascending.
Index of peak element
Implement a function that returns the index of any peak element in a given integer array.
Pascal Triangle Row
Given a non-negative integer n, return the nth row of Pascal's triangle as a list of integers.
Collatz Generator
Implement a generator function that yields the Collatz sequence starting from a given positive integer.
Digit Expansion Generator
Create a generator that lazily yields each decimal digit of a non-negative integer from most significant to least significant.
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.
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.
Euler Totient Function
Implement Euler's totient function φ(n) for positive integers.
Sieve of Eratosthenes
Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.
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.
Abundant Number Check
Implement a function to check whether a given integer is abundant: sum of proper divisors exceeds the number.
Armstrong Number Check
Implement a function that checks if a given integer is an Armstrong number.
Pentagonal Number
Given a positive integer n, return the nth pentagonal number using the formula P(n) = n(3n - 1)/2.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Multiply without multiply
Write a function that multiplies two integers using only addition, subtraction, and bit shifts — no * operator.
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.
Single Number XOR
Given a non-empty list of integers where every element appears twice except one, return the single number using XOR.
Gray Code Encode
Implement a function that converts a non-negative integer to its Gray code representation using bitwise XOR and shift.
Gray Code Decode
Implement gray_decode(n) that converts an n-bit Gray code integer back to its standard binary value using XOR accumulation.
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.
Isolate Rightmost Set Bit
Given an integer, return a number with only its rightmost set bit set.
Rotate Bits Left
Implement a function that rotates the bits of an integer to the left by a specified number of positions.
Add without plus
Implement a function that adds two integers using only bitwise operations, no arithmetic plus or minus.
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 kth Bit
Implement a function that clears the k-th bit of a non-negative integer (turns it to 0) using bitwise operations.
Sparse Number Check
Check if a non-negative integer is sparse, meaning its binary representation contains no adjacent 1 bits.
Brian Kernighan count
Implement a function that counts set bits using Brian Kernighan's efficient algorithm.
Permutation Generator
Write a function that returns all permutations of a list of distinct integers.
Showing 66 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.