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

Compare Python's three string-formatting styles: percent formatting, str.format, and f-strings. What are the readability, performance, and security (format-string injection) differences between them?

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.

HardTechnical
19 practiced

Design a caching decorator whose entries expire after a configurable TTL. What data structure backs the cache, how do you evict stale entries (lazily on access versus proactively), and what changes if you also need it to be thread-safe?

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.

EasyTechnical
20 practiced

What's the difference between repr and str on a Python class? Write a small class that implements both, showing the developer-facing versus user-facing representation.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.