All resources
Interview QuestionsJul 16, 20269 min read

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)

  1. Difference between list, tuple, set, and dict — with time complexities for common ops.
  2. How does Python's GIL affect multithreaded CPU-bound code, and when does asyncio help?
  3. Mutable default arguments — why is `def f(x=[])` a bug, and what's the fix?
  4. `is` vs `==` — when do small integers and interned strings mislead you?
  5. Decorators: write a decorator that caches results with a TTL.
  6. Generators vs iterators vs coroutines — when do you reach for each?
  7. Context managers — write one with __enter__/__exit__ and one with @contextmanager.

Data structures & problem-solving

  1. Two-sum in one pass using a hash map.
  2. Find the first non-repeating character in a stream.
  3. LRU cache with O(1) get/put — collections.OrderedDict or dict + doubly linked list.
  4. Merge k sorted lists with heapq.
  5. Detect a cycle in a linked list — Floyd's tortoise & hare.
  6. Word ladder / BFS on strings.

Pandas & numpy (for data roles)

  1. Difference between .loc, .iloc, and .at — when is each the right tool?
  2. Group-by with multiple aggregations and rename columns cleanly.
  3. Vectorise a row-wise operation that's currently a for-loop.
  4. Merge two dataframes on multiple keys with different join types.
  5. Handle timezone-aware timestamps and convert between UTC and local.
  6. 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

  1. Design a rate limiter in Python — token bucket vs sliding window.
  2. Design a background job system using Redis + RQ / Celery — retries, dead-letter, backoff.
  3. Design an ETL pipeline that pulls from an API and lands in a warehouse — idempotency, watermarks, backfill.
  4. 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

Keep reading