Introduction
Python job interview questions usually fall into four groups: core language basics like lists, tuples, and mutability; intermediate topics like generators, decorators, and exception handling; advanced topics like the GIL, concurrency, and memory management; and at least one live coding problem.
Interviewers care less about textbook definitions and more about whether you can explain why something works and spot where it breaks.
Below are the questions that come up most, with short answers and code you can run. They're grouped by level, followed by practice problems, role-specific topics, and a prep plan.
TL;DR
- Most Python interviews mix concept questions, a live coding round, and a discussion of your past projects.
- Know mutability, copying, *args and **kwargs, and the mutable default argument trap cold. They come up at every level.
- Be ready to write a generator, a decorator, and a context manager from memory.
- For senior roles, expect the GIL, threading vs multiprocessing vs asyncio, and the free-threaded build added in recent Python versions.
- In coding rounds, talk through your approach and state the time complexity before you write code.
What a Python job interview looks like
Most companies run some version of the same loop. The details vary, but knowing the rounds helps you prepare for each one separately.
For more on coding rounds, including pattern recognition and how to communicate during a problem, see our guide to mastering the coding interview.

Basic Python job interview questions
1. What's the difference between a list and a tuple?
Lists are mutable, so you can add, remove, or change items. Tuples are immutable once created. Because of that, a tuple of immutable values is hashable and can be a dictionary key or set member. Use tuples for fixed records, like coordinates, and lists for collections that grow or change.
2. What's the difference between mutable and immutable types?
Mutable objects, such as lists, dicts, and sets, can be changed in place. Immutable objects, such as int, float, str, tuple, and frozenset, can't. When you "change" a string, Python creates a new object. This matters for dictionary keys, function arguments, and bugs where two variables point to the same list.
3. What's the difference between is and ==?
== checks whether two objects have equal values. is checks whether they're the same object in memory.
a = [1, 2]
b = [1, 2]
a == b # True
a is b # False
Use is for None checks (if x is None) and == for comparing values. Don't rely on is for numbers or strings, since any caching CPython does there is an implementation detail.
4. What do *args and **kwargs do?
*args collects extra positional arguments into a tuple. **kwargs collects extra keyword arguments into a dict.
They're common in wrappers and decorators that pass arguments through to another function without knowing them in advance.
5. Why is a mutable default argument a problem?
Default values are evaluated once, when the function is defined, not each time it's called. So a mutable default is shared across calls.
def add_item(item, items=[]):
items.append(item)
return items
add_item(1) # [1]
add_item(2) # [1, 2], not [2]
The fix is to default to None and create a new list inside the function:
def add_item(item, items=None):
if items is None:
items = []
items.append(item)
return items
6. What's the difference between a shallow copy and a deep copy?
A shallow copy creates a new outer object but keeps references to the same inner objects. A deep copy recursively copies everything.
import copy
a = [[1, 2], [3]]
shallow = copy.copy(a)
deep = copy.deepcopy(a)
a[0].append(9)
# shallow -> [[1, 2, 9], [3]]
# deep -> [[1, 2], [3]]
Intermediate Python interview questions
7. What is a generator, and when would you use one?
A generator is a function that uses yield to produce values one at a time, pausing between them. It doesn't build the whole result in memory, which makes it useful for large files and data streams.
def read_lines(path):
with open(path) as f:
for line in f:
yield line.strip()
A good follow-up point: generator expressions, such as (x * 2 for x in data), look like list comprehensions but produce values lazily.
8. How do decorators work? Write one.
A decorator takes a function and returns a new function that adds behavior. This one times any function it wraps:
import functools
import time
def timer(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start = time.perf_counter()
result = func(*args, **kwargs)
print(f"{func.__name__} took {time.perf_counter() - start:.3f}s")
return result
return wrapper
@timer
def load_data():
Mention functools.wraps. It preserves the original function's name and docstring, and interviewers often check for it.
9. What is a context manager?
A context manager sets something up and guarantees cleanup, even if an exception occurs. The with statement uses it. You can write one as a class with __enter__ and __exit__, or more simply with contextlib:
import time
from contextlib import contextmanager
@contextmanager
def timed(label):
start = time.perf_counter()
try:
yield
finally:
print(f"{label}: {time.perf_counter() - start:.3f}s")
10. What's the time complexity of common list, dict, and set operations?
This question tests whether you pick the right data structure. These are average-case complexities in CPython.
The practical takeaway: if you check membership inside a loop, use a set or dict, not a list. If you need fast inserts at both ends, use collections.deque.
11. How do try, except, else, and finally work together?
try holds code that might fail. except handles specific exceptions. else runs only if no exception was raised. finally always runs, so it's the place for cleanup. Catch specific exceptions rather than a bare except:, so you don't hide real bugs.
Advanced Python interview questions
12. What is the GIL, and is it going away?
The Global Interpreter Lock in CPython lets only one thread execute Python bytecode at a time. It keeps memory management simple but limits CPU-bound work in threads.
It's changing. Python 3.13 added an experimental free-threaded build with the GIL disabled, and in Python 3.14, PEP 779 promoted that build to officially supported.
It's still optional, and the standard build still has the GIL. A strong answer also mentions that C extensions need to support free-threading, and that single-threaded code can run somewhat slower on that build.
13. When would you use threading, multiprocessing, or asyncio?
14. Show a basic asyncio example.
import asyncio
async def fetch(n):
await asyncio.sleep(1) # stands in for a network call
return n * 10
async def main():
results = await asyncio.gather(*(fetch(i) for i in range(3)))
print(results) # [0, 10, 20]
asyncio.run(main())
The three calls run concurrently, so the whole thing takes about one second, not three.
15. How does Python manage memory?
CPython mainly uses reference counting: each object tracks how many references point to it and is freed when that count reaches zero.
A separate cyclic garbage collector, exposed through the gc module, cleans up reference cycles that counting alone can't catch, such as two objects that point to each other.
16. What is the method resolution order (MRO)?
The MRO is the order Python searches classes for a method under inheritance, especially multiple inheritance. Python uses the C3 linearization algorithm, and super() follows the MRO rather than simply calling the direct parent.
class A:
def greet(self): return "A"
class B(A):
def greet(self): return "B" + super().greet()
class C(A):
def greet(self): return "C" + super().greet()
class D(B, C):
pass
D().greet() # "BCA"
D.__mro__ # D, B, C, A, object
17. What are dataclasses, and why use them?
The @dataclass decorator generates __init__, __repr__, and __eq__ for classes that mainly hold data. Adding frozen=True makes instances immutable and hashable. It removes boilerplate and makes the intent clearer than a plain class or a dict.
Python coding problems to practice
Coding rounds for Python roles lean on dicts, sets, and the standard library. Here are two problems that show up in many variations.
Two sum. Given a list of numbers and a target, return the indices of two numbers that add up to the target.
def two_sum(nums, target):
seen = {}
for i, n in enumerate(nums):
if target - n in seen:
return [seen[target - n], i]
seen[n] = i
return []
two_sum([2, 7, 11, 15], 9) # [0, 1]
This runs in O(n) time by trading memory for speed. Say that trade-off out loud. It's what the interviewer is listening for.
Most common words. Return the two most frequent words in a string.
from collections import Counter
text = "the cat and the hat and the bat"
Counter(text.split()).most_common(2) # [('the', 3), ('and', 2)]
Knowing Counter, defaultdict, and deque saves time and shows you know the standard library.
Other common practice problems include reversing the words in a sentence, checking for anagrams, merging overlapping intervals, and finding duplicates in a list.

Python interview topics by role
The core questions above apply everywhere, but each role adds its own focus.
If you're aiming at AI roles, our guide to AI/ML engineer jobs covers the skills employers screen for.
For a wider view of what recruiters look for on a resume, see IT skills that get you hired.
If you're interviewing for full stack roles, our guide to standing out in a full stack developer interview covers the front-end and system design side.
How to prepare in two weeks
- Days 1 to 4: Review the basic and intermediate questions, then write the generator, decorator, and context manager examples from memory until you don't need to look.
- Days 1 to 14: Solve one or two coding problems a day, focused on dicts, sets, strings, and lists. Say your approach out loud as you go.
- Days 5 to 10: Cover the advanced topics that match your target role, especially concurrency for backend and data roles.
- Days 10 to 13: Prepare two project stories with real numbers, like how much faster a pipeline ran or how many requests an API handled.
- Day before: Skim PEP 8, Python's official style guide, so your code looks familiar to reviewers.
The Python 3.14 "What's New" page is worth a quick read too. Interviewers sometimes ask what's changed in recent versions, and free-threading is the topic they're most likely to raise.
Final thoughts on Python job interview questions
Python job interview questions reward understanding over memorization. If you can explain why a mutable default argument misbehaves, when a generator beats a list, and when to use multiprocessing instead of threads, you'll handle most follow-ups.
Pair that with steady coding practice and two well-prepared project stories, and you'll walk in ready.
Start Strong With Consultadd
With 15 years in business and 5,000+ successful staffing engagements, we don't just fill roles, we build reliability into your process. We've supported 65 staffing companies in the past year alone and maintain MSAs with industry leaders like Robert Half and TEKsystems.
Here's what working with Consultadd looks like:
- Talent sourced in under 24 hours
- Ready-to-deploy candidates, vetted for experience and compliance
- Lower turnover risk: we match long-term goals, not just short-term needs
- Seamless compliance: visa, documentation, onboarding? Handled.
- Dedicated 1:1 account managers for responsive, personalized support
- Top 100 candidate matches delivered in the past year
- Strong partnerships with universities to tap into fresh, committed talent
- Post-placement support so your investment grows beyond day one
For candidates, your next opportunity is more than just a job title, it's a chance to build skills, gain experience, and move your career forward. At Consultadd, we connect technology professionals with projects and employers that align with their goals, whether they're looking for contract, contract-to-hire, or long-term opportunities.
The tech job market moves fast, but the right guidance can make all the difference. Ready to take the next step in your career journey? Explore Opportunities >>
Key takeaways
- Python interviews usually combine concept questions, live coding, a project deep dive, and a behavioral round.
- Mutability, copying, argument handling, and the mutable default trap are the most common basic questions.
- Generators, decorators, context managers, and data structure complexity dominate the intermediate level.
- Senior roles add the GIL, the free-threaded build, concurrency models, memory management, and the MRO.
- Practice explaining your reasoning out loud, since interviewers judge the explanation as much as the code.
FAQs
What are the most common Python job interview questions?
The most common questions cover lists vs tuples, mutable vs immutable types, *args and **kwargs, generators, decorators, and exception handling. Most interviews also include a coding problem built around dicts, sets, or strings.
What Python topics should freshers focus on?
Freshers should focus on data types, mutability, loops, functions, list comprehensions, basic OOP, and exception handling. Add a few practice problems a day and at least one small project you can explain in detail.
Do Python interviews ask about the GIL?
Mid-level and senior interviews often do, especially for backend and data roles. Be ready to explain what the GIL is, how it affects threads, and that Python 3.14 officially supports an optional free-threaded build without it.
How do I prepare for a Python coding interview?
Practice one or two problems a day on dicts, sets, strings, and lists, and say your approach out loud while you work. State the time complexity before you code, then test your solution with a simple example and an edge case.
Which Python libraries should I know for interviews?
For any role, know the standard library well, especially collections, itertools, functools, and contextlib. Then add the libraries your target role uses, such as Django or FastAPI for backend, pandas for data, or pytest for QA.
Should I use Python in coding interviews if the job uses another language?
Often, yes, if the company allows it. Python's short syntax saves time in live coding, but check with the recruiter first, since some teams want to see you code in the language you'll use on the job.
.webp)

.png)
.avif)