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

Explain Python's LEGB scope resolution (Local, Enclosing, Global, Built-in). Write a nested function example that shows when you need the nonlocal keyword to modify an enclosing variable.

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.

MediumTechnical
21 practiced

What are the risks of using pickle to load data or models from a source you don't fully trust? What safer alternatives would you reach for instead, and if you had to accept pickle input anyway, how would you restrict what it's allowed to deserialize?

EasyTechnical
21 practiced

Explain positional, keyword, and default arguments in Python, plus *args and **kwargs. Write one function signature that uses all of them and describe when each pattern is idiomatic versus overkill.

HardTechnical
22 practiced

A process automation tool needs to validate hundreds of files in parallel, but the final summary must be emitted in the same order the files were submitted. A fatal parse error should stop remaining work as quickly as possible. How would you structure the goroutines, communication, and shutdown logic in Go?

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.