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

Name a handful of Python standard library modules you reach for constantly in data-oriented work, parsing, compression, concurrency, data structures, and give a one-line reason for each.

HardTechnical
18 practiced

Given a shared counter incremented by several threads in a tight loop with count += 1, why does the final count come out wrong even though the GIL exists? Provide a corrected, efficient version, and explain which Python operations are actually safe to share across threads without a lock and which aren't.

MediumTechnical
20 practiced

For an in-memory dataset you're processing repeatedly, compare storing it as a list of dicts (row-oriented) versus a dict of lists or tuple-of-arrays (column-oriented). What changes about memory layout, CPU cache behavior, and which operations get faster or slower?

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

Write code that safely runs an external command via subprocess: avoiding shell injection, enforcing a timeout, and capturing stdout/stderr without leaving zombie or orphaned child processes behind.

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.