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

Swap Two Values

Implement a Python function that swaps two given values and returns them in swapped order.

variables assignment swap
+5 pts 5m
Python Basics easy

Is divisible by?

Create a function that returns True if a is divisible by b with no remainder, with a clear definition of edge cases.

division modulo conditionals
+10 pts 10m
Python Basics easy

Volume of Cube

Write a Python function that returns the volume of a cube given its side length.

arithmetic return function
+5 pts 5m
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
Strings & Text easy

Find all indexes of a substring

Write a function that returns a list of all starting indexes where a substring appears in a string, including overlapping occurrences.

substring string searching
+10 pts 15m
Strings & Text easy

Capitalize First Letter

Write a function that capitalizes the first letter of each word in a string.

string capitalization title
+8 pts 10m
Strings & Text easy

Parse key=value pairs

Implement a parser that converts a space-separated 'key=value' string into a Python dictionary, supporting quoted values.

parsing strings dictionaries
+8 pts 10m
OOP & Classes medium

Complex Number Class

Implement a Complex class supporting addition, subtraction, multiplication, division, equality, and string formatting.

classes magic-methods arithmetic
+20 pts 25m
Iterators & Generators easy

Custom iterator class

Implement a custom iterator class that repeatedly yields elements from a list up to a given number of times.

iterator class cycle
+10 pts 15m
Iterators & Generators easy

Range-like generator

Implement a custom generator that yields numbers like Python's range but with flexible bounds.

generator yield range
+8 pts 12m
Iterators & Generators easy

File Line Reader Generator

Implement a generator function that reads a file-like object and yields each non-empty line without loading the whole file into memory.

generators file-io lazy-evaluation
+10 pts 15m
Decorators & Context Managers easy

File Open Context Manager

Create a class that acts as a context manager for opening a virtual file in memory.

context-manager file-io python
+10 pts 15m
Decorators & Context Managers easy

Timer Context Manager

Implement a context manager that measures execution time of a with block and stores it.

context-manager timing measurement
+10 pts 15m
Regular Expressions easy

Multiline anchor match

Extract lines beginning with a plain-text prefix from multiline strings using Python's re module.

regex anchors multiline
+10 pts 15m
Binary Search medium

Interpolation Search

Implement interpolation search in Python on a sorted list of integers.

search sorted-array binary-search
+25 pts 25m

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