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.

HardTechnical
24 practiced

Write a short Python function detect_deadlocks(thread_dump) that, given a list of thread lock acquisition traces (each trace is a list of lock ids a thread holds and then requests), detects whether a circular deadlock is possible. Provide algorithmic complexity and a brief correctness argument.

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.

MediumTechnical
19 practiced

You receive a very large newline-delimited export of overdue tickets that cannot fit in memory. In Python, how would you process it so memory stays bounded, skip blank or malformed lines, and compute the totals needed for a daily report? Describe the code structure you would use and the tradeoffs you would make.

EasyTechnical
20 practiced

Describe a reproducible development environment for a Python data-science project. Include packaging, dependency pinning, virtual environments, and how you'd make runs reproducible across machines.

MediumTechnical
36 practiced

Explain how vectorized operations in NumPy and Pandas can be faster than explicit Python loops. Describe one situation where vectorization might be slower and why.

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.