Python Coding Challenges: Practice Questions
100 questions. Try each one yourself before checking the answer.
Short on time? Filter by Must Do for the 25 questions that cover this topic on their own.
FizzBuzz โ and then make it extensible.
Reverse a string, and reverse the words in a sentence.
Check for a palindrome, with and without cleaning the input.
Two Sum โ the canonical interview warm-up.
Find the missing number, and then the duplicate.
Move zeros, remove duplicates, and rotate โ all in place.
Count, group and find the most frequent.
Solve problems with set algebra instead of loops.
Recursive problems, with the iterative version beside each.
Classic number problems, done efficiently.
Bracket matching and expression evaluation.
Container with most water, and the merge of two sorted lists.
Longest substring without repeats, and the best fixed window.
Rotate, transpose and spiral a grid.
Sort by several fields, and sort things that are not obviously sortable.
Binary search and its three most common variants.
Build a linked list and solve the classic questions on it.
Build a binary tree and traverse it four ways.
Represent a graph and answer the standard questions.
The four DP problems that appear most often.
Design small data structures with the required complexity.
Read, parse and summarise a file safely.
Extract and validate with regular expressions.
Design a small class properly.
Solve one problem five ways and choose between them.
Compress a string, and know when compression makes it longer.
Anagrams, isomorphic strings and one-edit distance.
Parse and normalise messy human input.
Maximum subarray, and its three variations.
Product except self, and prefix sums.
Invert, merge and nest dictionaries safely.
Build an index and answer queries against it.
Merge intervals, and the family of problems around it.
Three Sum, and the general k-sum shape.
Minimum window substring, and anagram windows.
Flood fill, islands and the grid-BFS template.
Backtracking: generate, prune, and undo.
Knapsack, and the difference between the two versions.
Grid paths, and how a constraint changes the recurrence.
Dijkstra, and when BFS is enough.
Top-k, merging streams, and the running median.
Design a class hierarchy without over-engineering it.
Write generators that process data lazily.
Handle failure like production code.
Write the tests before the code.
Find the slow line before optimising anything.
Process a file too large to fit in memory.
Build a real log parser with named groups.
Speed up I/O-bound work with threads, and know why it fails for CPU work.
The method: how to attack a problem you have never seen.
Build a word frequency analyser that survives real text.
Validate a record against a schema and collect every error.
Load a CSV, clean it, and answer questions about it.
Validate a Sudoku board, then solve one.
Score a password, and hash it the way you actually should.
Model stock movements so the numbers always reconcile.
Sort a messy folder, safely and reversibly.
Add caching, and understand what it costs.
Implement the three common rate limiters.
Model a workflow as a state machine instead of a pile of flags.
Compare two versions of the same data.
Schedule tasks with dependencies and limited resources.
Move objects in and out of JSON without losing anything.
Find duplicates when "duplicate" is not obvious.
Build a small template engine.
Implement undo and redo two different ways.
Page through results without skipping or repeating rows.
Get the arithmetic right when it is money.
Layer configuration from several sources, with the right precedence.
Design an interface that is hard to misuse.
This function passes its tests and is wrong. Find out why.
Six innocent-looking lines that are secretly quadratic.
Comparisons, accumulation and precision, and how each one bites.
Track down a bug caused by two names for one object.
Convert deep recursion into iteration without changing the answer.
Find the race in code that looks thread-safe.
Find what is keeping objects alive.
Every way a sort can be subtly wrong.
Debug an encoding problem end to end.
Review this script the way an attacker would.
Review a hundred lines and rank what you find.
The algorithm is right and the program is slow. Fix the container.
Code that is correct at n=100 and unusable at n=10,000,000.
Every date bug in one scheduling feature.
Break a working monolith into testable pieces without changing behaviour.
Build a complete word frequency analyser with a command interface.
Build a log parser that finds problems, not just lines.
Build a Sudoku toolkit: validate, solve, rate and generate.
Build an encrypted password vault from standard-library parts.
Build a general CSV analyser that profiles any file it is given.
Build an inventory system with orders, reservations and reporting.
Build a file organiser with rules, deduplication and undo.
Build a recurring task scheduler with priorities and history.
Build a tokeniser, parser and evaluator for a small language.
Test a whole system: unit, property, integration and edge cases.
A full 45-minute coding interview, transcribed.
Design a URL shortener, out loud, in forty minutes.
Explain your reasoning: the sentences that earn the marks.
Complete a take-home assignment the way a senior engineer would.
The final question: build one program that uses everything.
Still stuck on something?
Book a free 1-on-1 session and we'll work through it together.
Book a Free Session