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.

HardSystem Design
26 practiced

Design a small internal CLI that watches a shared folder for incoming operational reports, validates each file, aggregates key metrics, and writes a daily summary for the operations team. What would you include in the design to make it reliable, idempotent, and easy to debug when one file breaks the run?

MediumTechnical
22 practiced

Write a function that converts a messy numeric string, things like '1,234.56', '$1.2M', 'NaN', or an empty string, into a float, returning None for anything unparseable. Would you check the input's shape before converting (look before you leap) or just try the conversion and catch the exception (ask forgiveness)? Justify your choice here.

MediumTechnical
22 practiced

Given a Pandas DataFrame with columns 'timestamp' (timezone-aware) and 'value', write code to resample to hourly bins in UTC, forward-fill missing values, and ensure the result preserves timezone awareness and dtype. Explain pitfalls around DST transitions.

MediumTechnical
22 practiced

Compare list comprehensions, map/filter, generator expressions, and plain for-loops as ways to transform data in Python. For each, when is it the clearest choice, and when does using map/filter over a comprehension actively hurt readability?

HardTechnical
19 practiced

Explain what a metaclass is in Python and implement one that automatically registers every subclass of a base class into a global registry keyed by class name. Why would you reach for a metaclass here instead of, say, init_subclass?

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.