Python Interview Questions: From Fundamentals to System Design
Python interviews in 2026 split cleanly into four buckets: language internals, data-structure problems, data-manipulation with pandas/numpy, and applied system design. Preparing all four is the shortcut most candidates skip.
Language internals (favourite of senior interviewers)
- Difference between list, tuple, set, and dict — with time complexities for common ops.
- How does Python's GIL affect multithreaded CPU-bound code, and when does asyncio help?
- Mutable default arguments — why is `def f(x=[])` a bug, and what's the fix?
- `is` vs `==` — when do small integers and interned strings mislead you?
- Decorators: write a decorator that caches results with a TTL.
- Generators vs iterators vs coroutines — when do you reach for each?
- Context managers — write one with __enter__/__exit__ and one with @contextmanager.
Data structures & problem-solving
- Two-sum in one pass using a hash map.
- Find the first non-repeating character in a stream.
- LRU cache with O(1) get/put — collections.OrderedDict or dict + doubly linked list.
- Merge k sorted lists with heapq.
- Detect a cycle in a linked list — Floyd's tortoise & hare.
- Word ladder / BFS on strings.
Pandas & numpy (for data roles)
- Difference between .loc, .iloc, and .at — when is each the right tool?
- Group-by with multiple aggregations and rename columns cleanly.
- Vectorise a row-wise operation that's currently a for-loop.
- Merge two dataframes on multiple keys with different join types.
- Handle timezone-aware timestamps and convert between UTC and local.
- Efficiently read a 10 GB CSV that doesn't fit in memory (chunksize, dtypes, pyarrow).
Testing, packaging, tooling
- Write a pytest fixture with scope='module' and explain when you'd use scope='function'.
- Mocking: patch a network call in a function you don't own.
- Explain the difference between requirements.txt, pyproject.toml, and lock files.
- How does virtualenv differ from Docker, and when do you need both?
Applied system design
- Design a rate limiter in Python — token bucket vs sliding window.
- Design a background job system using Redis + RQ / Celery — retries, dead-letter, backoff.
- Design an ETL pipeline that pulls from an API and lands in a warehouse — idempotency, watermarks, backfill.
- Design a URL shortener service and describe how you'd deploy it (FastAPI + Postgres + Redis).
For every Python question, offer the one-liner Pythonic answer first, then explain the underlying mechanic. Interviewers score for both idiom fluency and mental model — not one or the other.
Recommended next action
Take the next concrete step — it's free, takes under a minute, and gives you a real score to act on.
Practice a Python interview