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
- Sr Software EngineerPaypal · San Jose, California, United States of AmericahybridseniorPosted 1 hour ago
- Staff Software EngineerPaypal · San Jose, California, United States of AmericahybridstaffPosted 1 hour ago
- Sr Software EngineerPaypal · Austin, Texas, United States of AmericahybridseniorPosted 1 hour ago
- Software EngineerPaypal · San Jose, California, United States of AmericahybridmidPosted 1 hour ago
- Sr Software EngineerPaypal · San Jose, California, United States of AmericahybridseniorPosted 1 hour ago
- Software EngineerPaypal · Austin, Texas, United States of AmericahybridmidPosted 1 hour ago
- Software Engineer IIIwalmart · Sunnyvale, CAhybridmidPosted 1 hour ago
- (USA) Software Engineer IIIwalmart · (USA) Sam's Home Office AR Bentonville Home OfficeonsitemidPosted 1 hour ago
- Software Engineer, Silicon Design MethodologyOpenAI · San Francisco · RemoteonsitemidQuick applyPosted 2 hours ago
- Staff Software Engineer, Tax AccountsGusto · San Francisco, CAhybridstaffQuick applyPosted 2 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