Parse key=value pairs
Implement a parser that converts a space-separated 'key=value' string into a Python dictionary, supporting quoted values.
Parse coordinate pairs
Parse a string of coordinate pairs into a list of coordinate lists.
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.
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 Two Lists
Write a function that pairs elements from two lists by index, stopping at the shorter list.
Count Adjacent Pairs
Given a list of integers and a target, count adjacent pairs whose sum equals the target.
Cartesian Product Pairs
Create a function that returns the Cartesian product of two lists as a sorted list of lists.
Pair with difference K
Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.
Count Pairs with Sum
Implement a function that counts the number of distinct pairs in a list summing to a target.
Revenue by Month
Write a function that groups a list of (date, amount) pairs by year-month and returns total revenue per month as a sorted dictionary.
Count pairs with given difference
Count how many unordered pairs in a list have a given absolute difference using an efficient approach.
Top N per group
Implement top_n_per_group that returns the top N scores for each group from a list of (group, score) pairs.
Pairwise Sequence Pairs
Write a generator function pairwise that yields each consecutive overlapping pair from any iterable as lists.
Floyd-Warshall: All-Pairs Shortest Paths
Implement the Floyd-Warshall algorithm to find all-pairs shortest path distances in a directed graph with possibly negative weights but no negative cycles.
Generate Parentheses
Given n, generate all valid strings of n pairs of parentheses.
Queue Reconstruction by Height
Given shuffled pairs of (height, number_of_taller_people_in_front), reconstruct the original queue order.
Reverse Pairs Count
Implement a function to count reverse pairs in an array efficiently.
Find K pairs with smallest sums
Given two sorted arrays and an integer k, return the k smallest pairs (u, v) with the smallest sums, sorted by sum.
Showing 1–18 of 18 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
- Pick a category — basics, algorithms, strings, and more
- Open a challenge, read the statement, and edit the starter code
- 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.