InterviewStack.io LogoInterviewStack.io

Python Programming Questions

Python as an interview language: core syntax, data types and built-in collections, comprehensions, iterators and generators, idiomatic style, and the standard library, extending into data-oriented and automation use of the language and its common libraries. Covers writing correct, Pythonic code and reasoning about the language's semantics. The most heavily exercised language surface in this category across engineering and data roles.

MediumTechnical
19 practiced

Write a Pandas expression (or minimal code) to pivot a DataFrame df with columns ['user', 'metric', 'value'] into a wide DataFrame with one row per user and each metric as a column. Handle duplicate user-metric pairs by taking the last value. Show how to do this efficiently for large data.

EasyTechnical
26 practiced

What is the Global Interpreter Lock (GIL) in CPython? Give two examples of workloads where multi-threading in Python still provides benefit despite the GIL.

MediumTechnical
19 practiced

You're reviewing a pull request that replaces many small NumPy operations with chained expressions that create several temporaries, causing a memory regression. Provide a review checklist and concrete suggestions (code-level) to improve memory usage while keeping code readable.

MediumTechnical
22 practiced

You have a flaky unit test that intermittently times out. Outline a debugging and remediation plan in a Python project with pytest and CI, including how to reproduce locally, collect traces, and enforce test stability.

MediumTechnical
20 practiced

You maintain a codebase with heavy numeric work written in NumPy. A colleague proposes moving core loops to Numba for speed. What tests and benchmarks would you write to validate correctness and performance? Describe potential gotchas with Numba and how to test them.

Unlock Full Question Bank

Get access to all 46 Python Programming interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.