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
Python Basics easy

Euclidean Distance Matrix

Write a function to compute the Euclidean distance between every pair of points from two lists.

math lists loops
+10 pts 15m
Python Basics easy

Logging Filter

Given a list of log entries, return those matching a given severity level and containing a keyword.

strings conditionals loops
+8 pts 10m
Python Basics easy

Argmax along axis

Write a function that returns index positions of the maximum values along rows or columns of a 2D list.

lists max index
+10 pts 10m
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
Dicts & Sets easy

Group by Department

Implement a function that groups a list of employee dictionaries by department, returning a dictionary keyed by department with lists of employee dictionaries.

dicts loops grouping
+8 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 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 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
OOP & Classes easy

Deck of Cards Class

Implement a Deck class representing a standard 52-card deck with shuffle, deal, and len support.

oop classes random
+10 pts 15m
OOP & Classes easy

String Representation Mixin

Implement a mixin class that provides generic __repr__ and __str__ based on instance attributes.

oop repr mixin
+10 pts 15m
OOP & Classes easy

Dataclass with slots

Implement a slotted frozen dataclass representing a 2D point with total ordering.

dataclass slots immutability
+10 pts 15m
OOP & Classes easy

Singleton Factory

Implement a factory class that returns a singleton instance per key.

oop singleton factory
+8 pts 10m
OOP & Classes easy

Playing card class

Design a PlayingCard class with suit, rank, color, and equality/comparison magic methods.

oop classes magic-methods
+10 pts 15m
Error Handling & Exceptions easy

Validation result object

Implement a ValidationResult class that tracks validation errors and can report validity.

validation error-handling oop
+8 pts 15m
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 25–48 of 49 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

  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.