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.

EasyTechnical
22 practiced

Explain the difference between a list comprehension, generator expression, and using map/filter in Python. When would you prefer each? Give a short code example (2-3 lines) for each showing how to square numbers 0..9.

EasyTechnical
20 practiced

Given a NumPy array a of shape (N, M), write Python code to compute a boolean mask of rows that contain any NaN using vectorized NumPy operations. Do not use Python loops.

HardTechnical
18 practiced

Implement a safe file-based lock in Python usable across processes on the same machine. The API should support acquire(timeout) and release, and avoid race conditions if two processes try to create the lock simultaneously. Discuss platform differences (Unix vs Windows).

MediumTechnical
22 practiced

You have a large CSV (50 GB) to process with Pandas-style operations but not enough RAM. Describe an approach using Python and libraries to compute per-key aggregates (sum, count, mean) that scales. Provide code snippets or a step plan.

MediumTechnical
21 practiced

Describe how you would profile a Python data-processing pipeline that spends too much time in a pandas.apply call. Provide commands and explain how to interpret results and optimize the code after profiling.

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.