Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

925 challenges 556 easy 323 medium 46 hard
Math & Number Theory easy

Sum of divisors

Given an integer n, return the sum of all its positive divisors.

divisors math number-theory
+10 pts 15m
Math & Number Theory easy

Perfect Number Check

Write a function that returns True if a number is perfect, i.e., equal to the sum of its proper divisors.

math divisors number-theory
+10 pts 15m
Math & Number Theory easy

Abundant Number Check

Implement a function to check whether a given integer is abundant: sum of proper divisors exceeds the number.

math divisors number-theory
+10 pts 15m
Math & Number Theory easy

Amicable Numbers Check

Write a function that checks if two numbers are an amicable pair by comparing sums of proper divisors.

divisors arithmetic math
+10 pts 15m
Math & Number Theory easy

Armstrong Number Check

Implement a function that checks if a given integer is an Armstrong number.

arithmetic number-theory validation
+10 pts 10m
Math & Number Theory easy

Happy number check

Implement a function that returns True if a number is happy, False otherwise.

math loops set
+8 pts 12m
Math & Number Theory easy

Harshad Number Check

Write a function that checks if a number is a Harshad (or Niven) number.

math digits divisibility
+8 pts 10m
Math & Number Theory medium

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.

prime factors digit sum number theory
+20 pts 25m
Math & Number Theory easy

Triangular Number

Implement a function that returns the nth triangular number using the closed-form formula.

triangular formula math
+10 pts 10m
Math & Number Theory easy

Pentagonal Number

Given a positive integer n, return the nth pentagonal number using the formula P(n) = n(3n - 1)/2.

math formula integer
+10 pts 10m
Math & Number Theory easy

Lucas Sequence

Implement a function to compute the n-th Lucas number using iteration or recursion with memoization.

math sequence dynamic programming
+10 pts 15m
Math & Number Theory easy

Partition function

Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).

math recursion memoization
+12 pts 15m
Math & Number Theory easy

Multiply without multiply

Write a function that multiplies two integers using only addition, subtraction, and bit shifts — no * operator.

multiplication bit-manipulation arithmetic
+8 pts 12m
Math & Number Theory easy

Integer Square Root

Implement integer_sqrt(n) that returns the largest integer whose square is ≤ n.

math integer sqrt
+8 pts 10m
Math & Number Theory medium

Zeller Congruence Weekday

Implement a function that returns the weekday name for a given date using Zeller's congruence.

math modular-arithmetic date
+20 pts 20m
Math & Number Theory easy

Dot Product of Vectors

Implement a function that returns the dot product of two numeric vectors.

math lists dot-product
+10 pts 10m
Math & Number Theory easy

Modular Inverse

Implement a function that returns the modular inverse of a modulo m, or -1 if it does not exist.

modular-arithmetic euclid math
+10 pts 15m
Math & Number Theory easy

Chinese Remainder Theorem

Solve a system of congruences with pairwise coprime moduli using the Chinese Remainder Theorem.

modular arithmetic crt coprime
+10 pts 15m
Math & Number Theory medium

Extended Euclidean Algorithm

Implement the extended Euclidean algorithm to return (gcd, x, y) such that ax + by = gcd(a, b).

gcd extended-euclidean number-theory
+30 pts 25m
Math & Number Theory easy

Deficient Number Check

Write is_deficient(n) that returns True if the sum of proper divisors is less than n.

math number-theory divisors
+8 pts 8m
Math & Number Theory easy

Kaprekar number check

Check whether a given non-negative integer is a Kaprekar number in base 10.

math number-theory integer-properties
+10 pts 15m
Math & Number Theory medium

Polynomial Fit Coefficients

Implement a function that returns the coefficients of the best-fit quadratic polynomial for given points.

least-squares linear-algebra polynomial
+25 pts 25m
Math & Number Theory easy

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.

combinatorics math combinations
+10 pts 15m
Math & Number Theory medium

Multinomial coefficient

Write a function to compute the multinomial coefficient efficiently for given nonnegative counts.

combinatorics math division
+20 pts 20m

Showing 505–528 of 925 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

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. 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.