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.

MediumTechnical
26 practiced

In Go, implement a function that reads a text file containing one record per line, converts each valid line into a struct, and returns the parsed records along with any recoverable parse issues. Show how you would handle errors from opening the file, scanning lines, and parsing fields so the caller can decide whether to fail the job.

EasyTechnical
21 practiced

Explain the difference between deep copy and shallow copy in Python. Give an example using lists and a dict containing a list so the difference is clear.

MediumTechnical
21 practiced

Describe how you would profile a Python data-processing pipeline that spends too much time in a pandas.apply call. Provide commands and explain how to interpret results and optimize the code after profiling.

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.

MediumTechnical
24 practiced

Write a function merge_sorted_iterables(iters, key=None) that merges multiple sorted iterables (which may be generators) into a single generator yielding elements in sorted order. Use only standard library modules. Explain memory characteristics.

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.