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
21 practiced

Explain the difference between deep copy and shallow copy in Python. Give an example using lists and a dict containing a list so the difference is clear.

HardTechnical
18 practiced

Implement a thread-safe LRU cache decorator in Python without using functools.lru_cache (you may use threading primitives). The decorator should accept a maxsize and be safe for concurrent access by multiple threads. Discuss complexity and potential contention points.

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
22 practiced

Given a Pandas DataFrame df with columns ['user_id', 'event_time', 'value'], write idiomatic code to compute for each user the rolling 7-day sum of 'value' based on event_time (which is a datetime). Ensure the solution scales for millions of rows.

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.

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.