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

Implement a safe file-based lock in Python usable across processes on the same machine. The API should support acquire(timeout) and release, and avoid race conditions if two processes try to create the lock simultaneously. Discuss platform differences (Unix vs Windows).

MediumTechnical
22 practiced

Explain dependency management approaches for Python: requirements.txt with pip, pip-tools, Pipenv, Poetry, and Conda. For a reproducible data-science project, which would you pick and why?

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.

HardTechnical
38 practiced

You're given a function that intermittently raises MemoryError when processing large NumPy arrays. List a systematic debugging and mitigation plan: how to collect memory profiles, common causes, and code changes to reduce peak memory usage.

EasyTechnical
19 practiced

Write a pytest unit test (in Python) for a function normalize_email(email: str) that lowercases the domain part and strips whitespace, leaving the local part unchanged except trimming. Include tests for edge cases: leading/trailing whitespace, uppercase domain, empty string, and invalid type.

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.