📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Python from Zero Python Interview Prep

Python Interview Prep

6 min read Quiz at the end
Key Python interview topics: the GIL, mutable vs immutable types, shallow vs deep copy, generators vs lists, is vs ==, LEGB scope, *args and **kwargs, decorators, context managers, and data structure time complexities.

Python Interview Essentials

  • GIL — Global Interpreter Lock prevents true multi-threading in CPython
  • mutable vs immutable — lists are mutable, tuples/strings are not
  • shallow vs deep copycopy.copy() vs copy.deepcopy()
  • __init__ vs __new__ — __new__ creates instance, __init__ initialises
  • generator vs list — generators are lazy (memory efficient)
  • LEGB scope — Local, Enclosing, Global, Built-in
Topic Quiz · 5 questions

Test your understanding before moving on

1. What is the GIL?
💡 The GIL prevents multiple native threads from executing Python bytecode simultaneously.
2. Mutable vs immutable — which is a mutable type?
💡 Lists are mutable — you can change elements. Tuples, strings, ints are immutable.
3. What is LEGB?
💡 LEGB describes Python variable scope lookup order.
4. What is a generator?
💡 Generators use yield to produce values on demand without storing all in memory.
5. What does shallow copy mean?
💡 A shallow copy copies the container but nested objects are still shared.