Python Interview Questions
Python interview questions across language fundamentals, data structures and common gotchas for backend, data and automation roles.
Topics
- FundamentalsMutability, data types and common Python gotchas that come up in nearly every Python interview. 5 subtopics
- Data StructuresLists, tuples, dicts and sets — Python's built-in collections, their performance trade-offs, and the collections module that extends them. 5 subtopics
- Comprehensions & IterationList, dict and set comprehensions, generators, and the iterator protocol — Python's expressive, lazy approach to building and consuming sequences. 4 subtopics
- FunctionsArguments and unpacking, closures, decorators and higher-order functions — how Python treats functions as first-class objects. 4 subtopics
- Object-Oriented ProgrammingClasses, inheritance and the MRO, dunder methods, properties and dataclasses — object-oriented Python and its data model. 6 subtopics
- Errors & Exceptionstry/except/else/finally, the exception hierarchy, custom exceptions and context managers — robust error handling in Python. 3 subtopics
- Functional Programmingmap, filter and reduce, functools and itertools — composing programs from functions and lazy iterators. 3 subtopics
- Modules, Packages & EnvironmentsThe import system, packages, __main__, and virtual environments — how Python code is organized, shared and run. 3 subtopics
- Concurrency & ParallelismThreads and the GIL, multiprocessing, asyncio and concurrent.futures — running Python code concurrently and in parallel. 4 subtopics
- Memory & InternalsReference counting, garbage collection, object identity and the CPython execution model — how Python manages memory and runs your code. 3 subtopics
- Type Hints & TypingType annotations, the typing module, generics and protocols — optional static typing for modern Python. 2 subtopics
- Standard Library Essentialspathlib and os, datetime, regular expressions and JSON/CSV — the batteries-included modules every Python developer reaches for. 4 subtopics
- Testingpytest and unittest, fixtures and mocking — writing automated tests for Python code. 2 subtopics
- Pythonic IdiomsEAFP vs LBYL, PEP 8 style, and the common gotchas and anti-patterns that separate idiomatic Python from translated code. 3 subtopics