Values that appear once
Return a list of numbers that appear exactly once in the input list, in original order.
Sort by frequency
Sort a list by element frequency descending, with ties broken by order of first occurrence.
Pair with difference K
Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.
Frequency sort descending
Write a function that sorts a list by frequency descending while preserving original order for ties.
Dataclass with slots
Implement a slotted frozen dataclass representing a 2D point with total ordering.
Valid parentheses
Return True if brackets in the string close in the correct order.
Count pairs with given difference
Count how many unordered pairs in a list have a given absolute difference using an efficient approach.
Bubble Sort
Implement bubble sort that sorts a list of numbers in ascending order.
Selection Sort Implementation
Implement selection sort to sort a list of numbers in ascending order.
Argsort Indices
Implement a function that returns the indices that would sort a list of integers, with ties broken by original order.
Tree inorder generator
Write a generator function that yields a binary tree's node values in inorder traversal.
Flatten Nested List Iterator
Implement a class that iterates over all integers in a nested list structure in depth-first order.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Binary Tree Inorder Traversal
Implement an inorder traversal function that returns node values in left-root-right order.
Preorder Traversal
Implement a function that returns the preorder traversal values of a binary tree.
Postorder Traversal
Implement a function that returns the postorder traversal of a binary tree as a list of node values.
Search Insert Position
Return the index where a target should be inserted into a sorted list to maintain order.
Reverse a linked list copy
Return a new list with node values in reverse order without mutating the input.
Diagonal Traverse Matrix
Implement a function that returns all elements of a matrix in diagonal zigzag order.
Customers Never Order
Given Customers and Orders tables, return the names of customers with no orders, sorted alphabetically, or None if all have ordered.
Cumulative Sum SQL
Write a SQL query to compute cumulative sales totals per product ordered by sale date.
Showing 25–45 of 45 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
- 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.