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

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

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

Last Occurrence of a Value

Implement a function that returns the last index of a given value in a list, or -1 if it's not present.

lists search indexing
+10 pts 15m
Python Basics easy

Cycle a List Once

Implement a function that rotates a list right by one position.

lists rotation indexing
+5 pts 5m
Python Basics easy

Boolean Mask Filter

Write a function that filters a list based on a boolean mask and returns the selected elements.

filter boolean lists
+10 pts 15m
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

Average of a list

Write a function that computes the average of a list of numbers, handling empty lists by returning 0.

average list statistics
+5 pts 5m
Python Basics easy

Map, Filter, Reduce

Implement three functions using map, filter, and reduce to manipulate a list of integers.

map filter reduce
+10 pts 15m
Python Basics easy

Count Leading Zeros

Write a function that returns the number of leading zeros in a list of integers.

lists iteration counting
+8 pts 8m
Strings & Text easy

Safe Command Executor

Implement emulate_run that simulates running a command list and returns output and exit code.

string-parsing simulation lists
+8 pts 10m
Lists & Arrays easy

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.

prefix product lists
+10 pts 10m
Lists & Arrays easy

Move Zeros to the End

Reorder a list in-place, pushing all zeros to the end while preserving the order of non-zero numbers.

lists in-place two-pointer
+10 pts 15m
Lists & Arrays easy

Chunk a list into n-sized parts

Write a function that divides a list into sublists of at most n elements.

list chunking slicing
+10 pts 15m
Lists & Arrays easy

Rotate Left by k

Implement a function that rotates a list left by k positions.

rotation lists slicing
+10 pts 15m
Lists & Arrays easy

Interleave Two Lists

Write a function that interleaves two lists element by element, preserving order.

lists merge indexing
+10 pts 10m
Lists & Arrays easy

Running Maximum

Implement a function that returns a list where each element is the largest value seen so far.

lists cumulative maximum
+10 pts 15m
Lists & Arrays easy

Insert into a Sorted List

Implement a function that inserts a value into a sorted list at the correct position using binary search.

lists binary-search insertion
+10 pts 10m
Lists & Arrays easy

Average excluding min and max

Return the average of a list after discarding the lowest and highest elements, handling edge cases.

lists statistics sorting
+7 pts 10m
Lists & Arrays easy

Zip lists into pairs

Write a function that takes two lists and returns a list of two-element sublists pairing elements by index up to the shortest length.

zip lists pairs
+7 pts 10m
Lists & Arrays easy

Longest Run of Equal Values

Compute the length of the longest run (consecutive block) of equal elements in a list.

lists consecutive run-length
+8 pts 10m
Lists & Arrays easy

Middle Element of an Odd-Length List

Implement a function that returns the middle element of an odd-length list.

lists indexing basic
+5 pts 5m
Lists & Arrays easy

Is Subset of Another List

Write a function that returns True if every element in a given list exists in another list, ignoring duplicates.

subset membership lists
+8 pts 12m
Lists & Arrays easy

Unzip pairs into two lists

Write a function that takes a list of pairs and returns two separate lists: first elements and second elements.

zip unpacking lists
+10 pts 10m
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
Lists & Arrays easy

Intersection of Two Lists

Given two lists, return a sorted list of unique elements that appear in both lists.

intersection sorting unique
+10 pts 15m
Lists & Arrays easy

Union of Two Lists

Implement a function that combines two lists and returns only unique elements.

union list set
+10 pts 15m
Lists & Arrays easy

Difference of Two Lists

Write a function that returns items in list a that are not in list b, preserving order and duplicates.

lists difference counting
+8 pts 10m
Lists & Arrays easy

Chunk list into groups

Implement a function that splits a list into sublists of a given size.

list slicing chunking
+10 pts 10m
Lists & Arrays easy

Zip Two Lists

Write a function that pairs elements from two lists by index, stopping at the shorter list.

zip lists pairs
+8 pts 10m
Lists & Arrays easy

Last occurrence index

Implement a function that returns the last index of a given value in a list, or -1 if the value is not present.

lists indexing search
+10 pts 10m
Dicts & Sets easy

List intersection

Return the sorted list of elements common to both lists.

sets intersection
+8 pts 8m
Dicts & Sets easy

Are two lists the same multiset

Write a function that checks if two lists contain the same elements with the same multiplicities, ignoring order.

multiset dictionary counting
+10 pts 10m
Dicts & Sets easy

Sort by frequency

Sort a list by element frequency descending, with ties broken by order of first occurrence.

sorting frequency dictionaries
+10 pts 15m
Dicts & Sets easy

Set intersection size

Count how many distinct values appear in both of two given lists.

sets intersection counting
+5 pts 8m
Dicts & Sets easy

Symmetric Difference

Write a function that computes the symmetric difference of two lists, returning a sorted list of unique elements.

sets set-operations symmetric-difference
+8 pts 10m
Dicts & Sets easy

Disjoint Set Check

Check if two lists are disjoint by verifying they have no common elements.

sets list membership
+10 pts 15m
Data Structures & Algorithms easy

Selection Sort Implementation

Implement selection sort to sort a list of numbers in ascending order.

sorting selection-sort algorithm
+10 pts 15m
Iterators & Generators easy

Pairwise Sequence Pairs

Write a generator function pairwise that yields each consecutive overlapping pair from any iterable as lists.

generators iterators pairs
+10 pts 15m
Dynamic Programming easy

Triangle Minimum Path

Compute the minimum path sum from top to bottom of a triangle given as a list of lists.

dynamic-programming bottom-up arrays
+12 pts 20m

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