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

Your operations team gets weekly status items from different managers, but the same item can appear with different capitalization, extra spaces, or punctuation. In Python, write a function that normalizes the titles, removes duplicates while preserving the first occurrence, and returns the cleaned list. Assume a few thousand strings at most.

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.

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

Design a small experiment to measure the overhead of Python's exception handling in a tight loop. Provide code snippets to compare raising/catching exceptions vs error-code return approaches and describe how to interpret the results.

MediumTechnical
22 practiced

Write an async function gather_with_timeout(coros, timeout) in Python 3.8+ that schedules multiple coroutines and returns a tuple (done, pending) similar to asyncio.wait but cancels pending after timeout and ensures any exceptions are propagated. Include a small usage example.

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.