Interview prep
Python Interview Questions
Python interviews mix language internals with practical data-structure work. Expect live coding plus questions about the standard library.
Questions and answers
01What is the difference between a list and a tuple in Python?
Lists are mutable and slightly heavier; tuples are immutable, hashable when their contents are hashable, and can therefore be used as dictionary keys. Interviewers usually follow up by asking where immutability helps — shared constants, cache keys and function defaults.
02How does Python manage memory?
CPython uses reference counting plus a cyclic garbage collector for reference cycles. Objects are freed as soon as their refcount hits zero, which is why holding a reference in a global or a closure is the usual cause of a leak.
03What are decorators and when would you use one?
A decorator is a callable that takes a function and returns a wrapped function. They are used for cross-cutting behaviour — timing, retries, caching, authorisation — without touching the wrapped function's body.
04Explain the GIL and how you work around it.
The Global Interpreter Lock allows only one thread to execute Python bytecode at a time. IO-bound work still benefits from threads or asyncio; CPU-bound work needs multiprocessing, native extensions or a different runtime.
05What is the difference between deep copy and shallow copy?
A shallow copy duplicates the outer container and shares references to the nested objects; a deep copy recursively duplicates everything. Mutating a nested list after a shallow copy is the classic bug this question probes.
How to answer these well
Interviewers are not grading recall — they are checking whether you've hit the failure mode the question describes. Anchor every answer to something you actually shipped or debugged with Python.
Say the trade-off out loud. "I'd use X here, but it costs Y under Z conditions" scores higher than a clean textbook definition every time.
Roles asking for Python
- Staff/ Principal Software Engineer (L6/L7): AI Platform Model ServingNetflix · Remote, United States · RemoteremoteleadPosted 1 hour ago
- Staff Software Engineer, Tech FoundationsAirbnb · United StatesonsitestaffQuick applyPosted 1 hour ago
- Software Engineer, GenAI PlatformRoblox · San Mateo, CA, United StatesonsitemidQuick applyPosted 1 hour ago
- Staff Software Engineer - Backend NetworkingDragos · United StatesonsitestaffQuick applyPosted 2 hours ago
- Principal Software Engineer - Roblox DatabaseRoblox · San Mateo, CA, United StatesonsiteleadQuick applyPosted 2 hours ago
- Sr. Staff Software Engineer, AI Native Web PlatformDatabricks · Mountain View, CaliforniaonsitestaffQuick applyPosted 2 hours ago
- Principal Software Engineer, GPU ComputeRoblox · San Mateo, CA, United StatesonsiteleadQuick applyPosted 2 hours ago
- Senior Software Engineer, AI Teammates PlatformAsana · San FranciscoremoteseniorQuick applyPosted 3 hours ago
- Software Engineer, ComputeVercel · Hybrid - San FranciscoremotemidQuick applyPosted 3 hours ago
- Principal Embedded Software EngineerRocket Lab · Tucson, AZonsiteleadQuick applyPosted 4 hours ago
Related prep
- Software Engineer jobs
- Software Engineer career guide
- Data Engineer jobs
- Data Engineer career guide
- Data Scientist jobs
- Data Scientist career guide
- AI Engineer jobs
- AI Engineer career guide
- Java interview questions
- JavaScript interview questions
- React interview questions
- AWS interview questions
- Azure interview questions
- Kubernetes interview questions
- Docker interview questions
- Terraform interview questions