Practice Arena

Python Coding Challenges

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

467 challenges 330 easy 120 medium 17 hard
Python Basics easy

Sum of digits

Return the sum of all decimal digits of a non-negative integer.

arithmetic loops
2
+8 pts 10m
Python Basics easy

Collatz steps

Count how many steps the Collatz sequence takes to reach 1 from n.

loops math
1
+10 pts 12m
Python Basics easy

Factorial (iterative)

Compute n! iteratively without recursion.

loops math
+8 pts 8m
Python Basics easy

Prime checker

Return True if n is a prime number.

math loops
1
+10 pts 10m
Python Basics easy

Count down from n

Implement a function that returns a list from n down to 1.

loops range lists
+5 pts 5m
Python Basics easy

Sum numbers from 1 to n

Implement a function that computes the sum of all integers from 1 to n.

sum loop arithmetic
+5 pts 5m
Python Basics easy

Multiplication Table Row

Return the nth row of a multiplication table as a list of 1..n products.

loops lists multiplication
+5 pts 5m
Python Basics easy

Digit count of an integer

Given an integer, return the number of digits it has, handling negatives and zero correctly.

integers loops arithmetic
+5 pts 5m
Python Basics easy

Max of a variable-length list

Implement a function that returns the maximum value from a list of numbers without using max().

conditionals loops comparison
+10 pts 10m
Python Basics easy

Replace negatives with zero

Implement a function that replaces all negative numbers in a list with zero.

lists loops conditionals
+10 pts 10m
Python Basics easy

Count Multiples in a Range

Given a start, end, and divisor, count how many integers in [start, end] are divisible by the divisor.

multiples range divisibility
+10 pts 10m
Python Basics easy

Countdown printer

Implement a function that prints a countdown from a given number down to 1, then returns 'Go!'.

loops conditionals function-definition
+5 pts 5m
Python Basics easy

Count Positives

Count the positive numbers in a list of integers.

conditionals loops basic
+10 pts 10m
Python Basics easy

Find Minimum Value

Write a function that returns the minimum integer from a given list.

min list loop
+10 pts 10m
Python Basics easy

Print Pyramid Pattern

Implement a function that returns a centered asterisk pyramid as a list of strings.

loops strings pattern-printing
+10 pts 15m
Python Basics easy

Digit Count

Count the number of digits in an integer using arithmetic, without string conversion.

numbers loops math
+8 pts 12m
Python Basics easy

Linear Search Implementation

Implement a linear search function that returns the index of the first occurrence of a target in a list, or -1 if not found.

linear-search list index
+10 pts 15m
Python Basics easy

Enumerate with start

Implement a function that mimics Python's enumerate with a custom start index.

enumerate loops tuples
+5 pts 5m
Python Basics easy

Hexagonal Number

Write a function to check if a positive integer is a hexagonal number.

math loops conditionals
+10 pts 15m
Python Basics easy

Count trailing zeros

Write a function that counts the number of trailing zeros in the decimal representation of a positive integer.

loops integers basics
+5 pts 5m
Strings & Text easy

Remove Consecutive Duplicate Letters

Implement a function that removes consecutive duplicate letters from a string, keeping only one occurrence of each run.

strings loops manipulation
+10 pts 15m
Strings & Text easy

Interleave Two Strings

Given two strings s1 and s2, return a new string that interleaves them character by character, starting with s1.

strings merging loops
+8 pts 10m
Strings & Text easy

Count consonants

Write a function that counts the number of consonant letters in a string.

strings counting loops
+10 pts 10m
Strings & Text easy

Remove Duplicates from String

Given a string, return a new string with each character that repeats consecutively reduced to a single occurrence.

strings loop filter
+8 pts 10m
Strings & Text easy

Count Syllables (Simple)

Count syllables in a word by counting groups of consecutive vowels (a, e, i, o, u).

strings vowels counting
+10 pts 15m
Strings & Text easy

Expand compressed string

Implement a function that expands run-length encoded strings (e.g., 'a3b2' → 'aaabb').

strings parsing run-length-encoding
+10 pts 15m
Lists & Arrays easy

Generate a Multiplication Table

Build a function that returns an n x n multiplication table as a list of lists.

nested-loops list-comprehension matrix
+10 pts 10m
OOP & Classes easy

Stack class

Implement a Stack class with push, pop, peek, is_empty, and size.

OOP stack data-structures
+12 pts 15m
OOP & Classes medium

Linked list reversal

Implement a singly linked list and a function to reverse it in place.

linked-list OOP pointers
+28 pts 25m
OOP & Classes medium

Matrix addition operator

Implement a Matrix class that supports + and * operators.

OOP dunder matrix
+22 pts 20m
OOP & Classes easy

Event emitter basics

Implement an EventEmitter class with subscribe/emit/unsubscribe functionality.

oop callbacks events
+10 pts 15m
OOP & Classes easy

Queue class (list-based)

Implement a Queue class with enqueue, dequeue, peek, is_empty, and is_full methods using a list.

queue oop list
+10 pts 15m
OOP & Classes medium

Comparable mixin

Create a Comparable mixin that auto-generates all rich comparison operators from a single __lt__ method.

oop mixin dunder-methods
+20 pts 20m
OOP & Classes medium

Class Method Factory

Create a class method factory that dynamically adds methods to a class based on a mapping of names to behaviors.

oop metaprogramming factory
+20 pts 25m
OOP & Classes easy

Abstract Base Class

Create an abstract Shape class and implement Rectangle and Circle subclasses with area and perimeter.

abc abstract oop
+10 pts 15m
Advanced Python medium

2D Vector dataclass

Implement a Vector2D dataclass with +, -, scalar *, dot product, and magnitude.

dataclass OOP math
1
+20 pts 18m
Advanced Python hard

Data pipeline

Implement a Pipeline class supporting pipe chaining with the | operator.

functional OOP pipeline
1
+40 pts 35m
Advanced Python hard

Validated descriptor

Implement a TypedField descriptor that raises TypeError if the value is not of the expected type.

descriptors OOP metaclass
+40 pts 35m
Math & Number Theory easy

Sieve of Eratosthenes

Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.

primes sieve loops
+10 pts 15m
Math & Number Theory easy

Prime Factorization

Return a sorted list of prime factors of a positive integer, including repeated factors.

prime math loops
+10 pts 15m
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

Showing 41 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.