Python Interview Questions
40 interview questions in our bank cover Python, most of them Coding Questions. They average 2.9/5 difficulty — medium — and each one was reported by a candidate after a real interview. Companies known to ask about Python: OpenAI, Figma, Anthropic, Meta, Okta, and 15 more.
Practice these on the problems board →Companies that ask about Python
Question mix
- Coding Questions37
- Deep Learning & Architectures1
- LLMs & Prompt Engineering1
- ML Fundamentals & Algorithms1
Difficulty
- 1/5 — warm-up1
- 2/5 — easy6
- 3/5 — medium28
- 4/5 — hard5
Python questions at OpenAI
ModalLock and FairModalLock
4/5Explore advanced concurrency concepts with this Python synchronization problem frequently utilized in machine learning infrastructure interviews at OpenAI. You are tasked with implementing specialized locking primitives that manage thread access across distinct operational modes while preventing thread starvation through FIFO fairness guarantees. This exercise examines your mastery of low-level concurrency controls, condition variables, and thread coordination. Unlock the complete problem specifications and the reference model solution with a paid subscription.
Coding QuestionsOpenAIResumable Iterator with Multi-Dimensional Support
3/5Build iterators that can be paused, serialised, and resumed from exactly where they stopped, first over a flat list and then over two- and three-dimensional data. This OpenAI round is a test-driven design exercise: the position itself becomes a value you have to define, store, and validate. You will decide what a resume token contains, keep nested dimensions consistent, and defend the interface against a token from a different dataset. The full problem and the reference design require a paid subscription.
Coding QuestionsOpenAIResolve Python Dependency Versions
4/5Resolve a set of package requirements into an installable plan, honouring version ranges and reporting an honest conflict when no plan exists. Reported at OpenAI, this engineering-heavy question grows through several stages and rewards correctness and clear data modelling over clever optimisation. You will model constraints as a graph, order work so that dependencies come first, and distinguish a genuine conflict from a resolution order you have not tried yet. A subscription gives access to the complete problem and the reference resolver.
Coding QuestionsOpenAIReproduce Double Descent in Linear Regression
3/5Recreate the double-descent curve in the simplest possible setting: ordinary least squares on synthetic Gaussian data, sweeping the parameter count from well under the sample size to well over it. Asked at OpenAI, this task tests whether you can set up a clean experiment and then explain the test-error spike at the interpolation threshold instead of hand-waving at it. You will manage the under- and over-parameterised regimes, the role of noise, and why the minimum-norm solution recovers as capacity grows. Subscribers get the full problem text and the worked analysis.
ML Fundamentals & AlgorithmsOpenAI
Python questions at Figma
FigJam Table — Selection & Set Color
3/5This frontend system design challenge, frequently encountered in technical interviews at Figma, requires you to architect a flexible digital canvas table component that handles hierarchical selection states and layered visual properties. You will need to implement data structures and simulation logic that correctly resolve style overrides across entire grids, individual rows, and specific cells as user selections shift. This question evaluates your proficiency in object-oriented modeling, state management, and clean API design for interactive applications. Access the full architectural requirements and reference implementation by obtaining a subscription.
Coding QuestionsFigmaDocument / Layer — Apply, Undo, Commit Batch, Redo
3/5Master state management and command patterns with this popular Figma technical interview exercise. Candidates are asked to construct a hierarchical document model containing customizable layers, then implement functionality for property adjustments, rollbacks, grouped batch operations, and forward execution. While the underlying computational logic remains straightforward, success hinges on designing a pristine object architecture capable of handling intricate specifications cleanly. To explore the complete problem statement and review an optimized reference implementation, an active platform subscription is required.
Coding QuestionsFigmaML Coding — BERT Span / Keyphrase Extraction
3/5In this hands-on machine learning coding challenge reported at Figma, applicants work within a notebook environment to build a transformer-based span extraction pipeline. The task assesses practical PyTorch skills by requiring the implementation of model architecture initialization, custom loss calculations, and training loops to successfully locate key phrases within text data. Mastering sequence tagging tasks is essential for modern natural language processing roles. Unlock the full implementation guide and verified solution by subscribing today.
Deep Learning & ArchitecturesFigmaData Engineer Screen — SQL Collaborator Model + IPv4 Validation
3/5This data engineering technical screen, featured at Figma, evaluates proficiency in both relational database querying and string manipulation. The first portion involves analyzing user activity logs to identify initial design shares and modeling close collaborator relationships, while the second part requires parsing and validating network address strings. The complete problem requirements, dataset schema, and model solutions are available exclusively to subscribers.
Coding QuestionsFigma
Python questions at Anthropic
Debug / Fix an Extremely Randomized Trees (ExtraTrees) Implementation in NumPy
4/5Repair a NumPy-only implementation of a randomised decision-forest learner that either crashes, predicts wrongly, or fails to reproduce its own results. This Anthropic debugging round is about reading someone else's array code: the bugs hide in indexing, in split selection, and in how the random state is threaded through. You will get the unit tests passing without reaching for another library, and explain which defect caused which symptom. Subscribers can read the complete problem and the corrected implementation.
Coding QuestionsAnthropicPython Class and Data Structures
2/5Assemble a small container class that keeps a unique collection, returns it in order, exposes hash values, and finds an element by halving the search space. This Anthropic warm-up is really about choosing the right built-in for each operation and knowing what each one costs. You will keep the sorted view consistent with the underlying set, decide when to re-sort, and handle lookups for elements that are not present. The full problem and the model implementation are available to subscribers.
Coding QuestionsAnthropicCoding Q2 — File Deduplication
3/5Scan a directory tree and group files whose contents are byte-identical, cheaply enough that you are not hashing everything you touch. This Anthropic question is short to state and scored on the follow-ups: comparing by size first, choosing a digest, and reasoning about whether the job is bound by disk or by processor. You will exclude files with no partner from the output, handle unreadable paths, and say how the approach holds up on a very large tree. A subscription unlocks the complete problem and the reference solution.
Coding QuestionsAnthropicLongest-Match Tokenizer with Unknown Tokens
3/5A coding question on turning a string into integer ids by greedily matching the longest known piece at every position, with a fallback id for unknown characters. It checks careful handling of overlapping entries, a sentinel entry and runs of unknown characters.
Coding QuestionsAnthropic
Python questions at Meta
Ads Ranking Algorithm
3/5Order a set of adverts by three metrics applied in priority order, returning just the identifiers. This Meta question is a custom-sort exercise, and the thing it checks is whether you express a multi-key comparison as one key tuple rather than as nested comparisons. You will get the descending direction right on every field, decide what breaks a complete tie, and keep the sort stable where the specification leaves a choice. The complete problem and the reference solution are available to subscribers.
Coding QuestionsMetaPython Function for Data Processing
2/5Filter a list of sales records down to the distinct customers who spent above a threshold in a particular year. This Meta question is everyday data work with three conditions to combine, and the date handling is where most of the errors live. You will parse the date robustly rather than slicing the string blindly, deduplicate the names, and decide whether the output order is specified or your choice. The complete problem and the reference function are available to subscribers.
Coding QuestionsMetaTotal Revenue per Category
1/5A short coding question about summarising order rows into one total per product category when some rows have no value recorded. It tests careful treatment of missing versus zero values, negative amounts, and a defined key order in the result.
Coding QuestionsMeta
Python questions at Okta
Python + SQL Technical Round (Typing, Debugging, Joins)
3/5Prepare for a senior engineering technical evaluation modeled after real-world Okta interview assessments. This multi-faceted discussion spans core language competencies, including static typing annotations, bug fixing, performance complexity analysis, and database querying via relational joins. It is designed to evaluate your deep technical fluency and architectural communication skills across backend domains. Unlock the complete breakdown of discussion points, code snippets, and expert answers by securing a subscription.
Coding QuestionsOktaFix a Sign-In Handler: Validation, Errors and Account Enumeration
3/5A debugging question about a short password sign-in function that misbehaves on bad input. The fix must reject malformed requests, turn every internal failure into a generic error, return only safe user fields, and make a missing account look exactly like a wrong password, including the amount of work done.
Coding QuestionsOktaToken Bucket Rate Limiter with Standard Rate-Limit Headers
3/5A coding question on limiting requests per client with buckets that refill continuously over time. Each call reports whether it may proceed together with the standard limit, remaining and reset headers, a separate call reads the state without spending anything, and an invalid configuration is refused at startup.
Coding QuestionsOkta
Python questions at Stripe
Mako Template Engine Debugging Round
4/5This Stripe live debugging round drops you into the actual open-source Mako Python templating codebase to diagnose and resolve subtle defects under a strict time limit. Rather than testing raw algorithm creation, it evaluates your systematic troubleshooting methodology, stack trace interpretation, and ability to land safe, isolated code corrections. Access to the complete debugging environment setup, scenario briefs, and expert resolution strategies requires a subscription.
Coding QuestionsStripeRequests Library Debugging Round
3/5In this Stripe debugging challenge, you are tasked with diagnosing and resolving subtle failure modes within Python HTTP networking libraries. You must investigate anomalous behavior involving protocol redirects, header encodings, or retry policies, and craft a minimal, robust patch under time constraints. This scenario tests your troubleshooting methodology and familiarity with network request lifecycles. Viewing the complete diagnostic details and reference fix requires a subscription.
Coding QuestionsStripeColander Validation Debugging Round
4/5Navigate a live codebase debugging challenge centered around data validation logic, reflecting real-world engineering problem-solving at Stripe. You will investigate a serialization library where nested rules or custom validators fail to process edge-case payloads correctly. The goal is to rapidly reproduce the failure, isolate the root cause, and implement a precise, minimal patch under strict time constraints. Unlock the full diagnostic walkthrough and correct implementation details with a paid subscription.
Coding QuestionsStripe
Python questions at Shopify
URL Shortener Service (CLI)
3/5Designed around a Shopify technical screen, this coding and system design task requires you to build a functional command-line URL encoding and resolution utility. While the algorithmic core is lightweight, the exercise heavily emphasizes robust object-oriented design, collision mitigation strategies, persistence choices, and thorough testing protocols. Unlock the complete requirements, architecture guidance, and reference implementation by subscribing.
Coding QuestionsShopifyMars Rover / Robot Controller (CLI)
3/5This widely reported pair-programming exercise from Shopify challenges engineers to build a command-line interface application that simulates a robotic rover navigating a two-dimensional grid space. Candidates must implement directional state tracking, movement mechanics, and boundary processing based on sequential instructions while gracefully handling edge cases. Although the initial specifications appear straightforward, the real evaluation centers around extensibility, clean object-oriented architecture, and handling complex follow-up requirements. The complete problem statement, testing strategies, and expert reference solution are exclusively available to paid subscribers.
Coding QuestionsShopify
Python questions at Intuit
Weather Data Energy-Usage Ranking
3/5Presented during Intuit applied data science screens, this practical analytics challenge requires you to process historical meteorological observations to estimate and rank residential utility consumption patterns. You must formulate a defensible mathematical proxy using temperature and precipitation metrics to evaluate heating and cooling burdens across multiple days. It tests your data wrangling abilities and feature engineering judgment. Access the full dataset context, evaluation criteria, and model solution by subscribing.
Coding QuestionsIntuitPandas Meeting Work-Duration Calculation
3/5Handling temporal data and interval merging is a practical skill tested heavily in data-centric engineering roles, as seen in Intuit interview questions. This task requires parsing timestamp logs, grouping schedules by individual and date, consolidating overlapping time slots to prevent double-counting, and computing maximum daily workloads. It tests your ability to manipulate structured datasets and apply interval algorithms effectively. To view the complete problem details, optimal data-frame strategies, and reference code, a subscription is required.
Coding QuestionsIntuit
More Python questions
Python Data Processing Question
2/5Take a list of employee records and report the mean age within each department of the company. This Microsoft question is routine aggregation, and the marks go to the parts around it: the signature you choose, the tests you write, and a word about how the approach behaves as the record count grows. You will accumulate totals and counts together, decide what an absent or malformed field does, and keep the result stable. The complete problem and the reference solution are available to subscribers.
Coding QuestionsMicrosoftReverse Each Line in a File and Write to Another File
2/5Solve a practical file processing task frequently featured in Fortinet coding screenings. This exercise requires you to write clean, idiomatic Python code that reads text from a designated source, processes individual lines by reversing their character sequences, and outputs the transformed data to a new destination. It tests your fundamental file I/O handling, string manipulation skills, and script reliability under standard constraints. Access the complete problem description and professional solution scripts with a subscription.
Coding QuestionsFortinetImplement a Coroutine Step by Step
3/5Reported as an interview challenge at Hudson River Trading, this exercise evaluates your grasp of generator functions and stateful execution in Python. You are asked to construct a lightweight coroutine capable of accepting runtime numeric inputs, maintaining a running cumulative total, and providing graceful termination handling. Success depends on utilizing generator syntax effectively to preserve internal state between external data transmissions. The full problem and model solution require a subscription.
Coding QuestionsHudson River TradingFix Python for-loop and indentation syntax errors
2/5This InterSystems technical assessment tests your foundational knowledge of Python syntax, focusing on proper loop construction, conditional statements, and indentation rules. The exercise evaluates your attention to detail in spotting missing syntax elements and correcting structural formatting. You will learn how to troubleshoot common compilation hurdles typical in beginner-level scripts. Unlock the complete debugging walkthrough and correct code snippet with a subscription.
Coding QuestionsInterSystemsVersioned Key-Value Store with Point-in-Time Reads
3/5A coding question on designing a key-value store that keeps the full history of every key and answers reads as of any past moment. You implement a write method and a point-in-time read method that returns the value in effect at the requested time, or an empty string when none exists.
Coding QuestionsCitadelMultithreaded BankAccount Race-Condition Bug Hunt
2/5This xAI coding challenge investigates concurrency vulnerabilities by presenting a flawed financial account implementation prone to classic multithreading hazards. Candidates must identify timing defects and demonstrate safe encapsulation patterns to prevent data corruption during simultaneous updates. Unlocking the complete troubleshooting guide and model code requires a subscription.
Coding QuestionsxAIAnalytics Engineer: SQL + Python Sessionization
3/5Practice dual-domain data processing combining advanced relational database queries and Python-based sessionization algorithms, highlighted in analytics engineering loops at Robinhood. This problem tests your ability to handle sharded datasets with complex join conditions and group event logs into distinct time-capped sessions. It is designed to evaluate practical data transformation skills used in production data pipelines. The full problem documentation, datasets, and complete model solutions require an active subscription.
Coding QuestionsRobinhoodRetrieve Text Values of Two Web Elements Using Selenium
3/5Featured in Glean engineering interviews, this practical test requires you to write robust browser automation code using Selenium to extract text content from specific page elements. You must handle dynamic loading conditions by implementing appropriate wait strategies before retrieving the requested text strings safely. It effectively tests your familiarity with web testing frameworks and asynchronous element handling. Unlock the complete problem prompt and expert automation script by securing a subscription.
Coding QuestionsGleanRAG Notebook (ML Coding)
3/5During a machine learning coding evaluation reported at Harvey, candidates complete a practical notebook exercise centered on building a simple retrieval augmented generation pipeline. The task involves processing tabular data with pandas to generate text embeddings, executing similarity searches to retrieve relevant context, and running evaluation metrics using provided utility functions within a collaborative environment. Unlock the complete coding challenge requirements, starter code explanations, and expert model solutions with a paid subscription.
LLMs & Prompt EngineeringHarveyCode Review — Multi-PR Walkthrough
3/5In this interactive Airbnb interview round, candidates are placed in the role of a reviewer examining multiple pull requests of escalating complexity and architectural depth. You are expected to proactively lead the review, spot subtle logic bugs, highlight maintainability concerns, and suggest missing test coverage without relying on interviewer prompts. This evaluation measures your code craftsmanship, communication clarity, and software design intuition. Read the full walkthrough guide and expert evaluation criteria by securing a paid subscription.
Coding QuestionsAirbnbWebsite Activity Analytics: Unique Users + Session Time
3/5This reported Google coding interview challenge evaluates your ability to process web log data effectively. You are asked to compute distinct visitor totals for various actions alongside calculating the average duration users spend browsing the platform. The exercise tests your data aggregation skills and requires careful handling of edge cases rather than just pristine code. The complete problem statement, underlying logic, and verified model solution require a subscription.
Coding QuestionsGoogleBagging Decision Trees Without NumPy
3/5A coding question on combining many copies of a supplied tree classifier into one more stable model, using only the Python standard library. You draw resampled training sets from a seeded generator and merge the copies' predictions, so the same seed must always reproduce the same output. It tests exact reproducibility, careful handling of ties between classes and working without numerical libraries.
Coding QuestionsPinterestConcurrent Web Crawler with Sorted CSV Export
3/5A hands-on engineering question about building a robust concurrent program that gathers data from many web pages, orders the results and exports them. It checks how you handle shared state, failures and scale.
Coding QuestionsSalesforceCode Review of a Seeded Python Service
3/5A code review exercise: read a small Python module that mixes SQL, configuration, request handling and a payment call, and write actionable comments on its defects. It tests breadth of review across security, concurrency, schema design and error handling.
Coding QuestionsSalesforceImplement a Vending Machine with Bill Insertion and Change-Making (OOD)
3/5This Zip object-oriented design question tests how you model a vending machine with clear classes, explicit result statuses, and correct transaction state. The core challenge is paying change only from the coins the machine actually holds, and rolling back cleanly when that fails.
Coding QuestionsZip
Studied alongside
Python interview FAQ
- How many Python interview questions are there?
- 40 reported questions, mostly Coding Questions.
- Which companies ask Python questions?
- OpenAI (4), Figma (4), Anthropic (4), Meta (3), Okta (3), Stripe (3), Shopify (2), Intuit (2).
- How hard are Python questions?
- They average 2.9 out of 5: 1 at 1/5, 6 at 2/5, 28 at 3/5, 5 at 4/5.