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.

MediumTechnical
22 practiced

An overnight Python job reads a directory of daily status files. Some files are empty, one file has a malformed line, and another file may be missing. How would you structure the job so it keeps processing valid data, records which files failed, and still gives the operator a useful summary at the end?

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 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.

HardTechnical
19 practiced

Implement a memory-efficient CSV reader in Python that streams rows and yields namedtuples for each row, converting numeric-looking fields to int/float when appropriate. The function should accept a file path or file-like object and a chunk_size parameter controlling internal buffering.

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.