Python is the most commonly used language in FAANG coding interviews and the dominant language in data engineering, machine learning, and backend roles at product companies. Whether you are using Python for a coding round at Google or Meta, a backend engineering role at a startup, or a data engineering position at an IT services firm, the interview tests a consistent set of topics.
If you want to practice these questions with a real engineer before your actual interview, book a mock interview on Intervue.io. The rest of this guide gives you what you need to walk in prepared.
What a Python Interview Covers
Python interviews test across several areas depending on the role.
For coding and algorithmic rounds, Python is evaluated as a tool: can you use it fluently to implement solutions. For backend and software engineering roles, Python internals, memory model, and runtime behaviour are tested. For data roles, generators, iterators, and library knowledge become more relevant.
The areas tested in most Python interviews: core language features, data structures and their Python implementations, object-oriented programming, memory management and the GIL, common gotchas, and practical coding under time pressure.
Core Language Questions
What is the difference between a list and a tuple?
Both store ordered sequences of elements but differ in mutability and performance.
A list is mutable: you can add, remove, or change elements after creation. A tuple is immutable: once created it cannot be changed.
Tuples are slightly faster than lists for iteration and take less memory. They are hashable (if all elements are hashable) so they can be used as dictionary keys or set members. Lists cannot.
Use tuples for data that should not change (coordinates, RGB values, database records). Use lists when you need to modify the collection.
What are Python decorators and how do they work?
A decorator is a function that takes another function as input, extends or modifies its behaviour, and returns a new function. Decorators use Python's first-class function feature.
python
def log_calls(func):
def wrapper(*args, **kwargs):
print(f"Calling {func.__name__}")
result = func(*args, **kwargs)
print(f"Finished {func.__name__}")
return result
return wrapper
@log_calls
def add(a, b):
return a + b
add(2, 3)
# Output:
# Calling add
# Finished add
The @log_calls syntax is shorthand for add = log_calls(add). Decorators are used heavily in web frameworks (Flask's @app.route), testing (unittest.mock.patch), and authentication middleware.
What is the difference between deepcopy and shallow copy?
A shallow copy creates a new object but does not recursively copy the objects it contains. The new object's elements still reference the same objects as the original.
A deep copy creates a completely independent copy, recursively copying all nested objects.
python
import copy
original = [[1, 2], [3, 4]]
shallow = copy.copy(original)
deep = copy.deepcopy(original)
original[0][0] = 99
print(shallow[0][0]) # 99: shallow copy shares inner lists
print(deep[0][0]) # 1: deep copy is fully independent
What are generators and when should you use them?
A generator is a function that uses yield instead of return. It produces values one at a time and only computes the next value when asked. This makes generators memory-efficient for large sequences because they do not load everything into memory at once.
python
def fibonacci():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
gen = fibonacci()
print(next(gen)) # 0
print(next(gen)) # 1
print(next(gen)) # 1
print(next(gen)) # 2
Use generators when processing large files line by line, generating infinite sequences, or producing values in a pipeline to avoid storing intermediate results in memory.
What is the GIL and how does it affect Python concurrency?
The Global Interpreter Lock (GIL) is a mutex in CPython that allows only one thread to execute Python bytecode at a time, even on a multi-core processor.
This means Python threads do not achieve true parallelism for CPU-bound tasks. Two threads running a computation simultaneously will not actually run in parallel: one holds the GIL and the other waits.
However, the GIL is released during I/O operations. For I/O-bound tasks (waiting for network responses, reading files), Python threads are effective because while one thread waits for I/O, another can run.
For CPU-bound parallelism, use multiprocessing instead of threading. Each process has its own GIL and runs in true parallel on separate cores. The tradeoff is higher memory usage and more complex inter-process communication.
What is the difference between *args and **kwargs?
*args allows a function to accept any number of positional arguments. Inside the function, args is a tuple.
**kwargs allows a function to accept any number of keyword arguments. Inside the function, kwargs is a dictionary.
python
def display(*args, **kwargs):
print("Positional:", args)
print("Keyword:", kwargs)
display(1, 2, 3, name="Alice", age=30)
# Positional: (1, 2, 3)
# Keyword: {'name': 'Alice', 'age': 30}
Object-Oriented Python Questions
What is the difference between @classmethod and @staticmethod?
A regular instance method receives self (the instance) as the first argument and can access instance attributes.
A @classmethod receives cls (the class itself) as the first argument. It can access and modify class-level attributes and is commonly used for alternative constructors.
A @staticmethod receives neither self nor cls. It is just a function that lives in the class namespace for organisational purposes and cannot access instance or class attributes without an explicit reference.
python
class Date:
def __init__(self, year, month, day):
self.year, self.month, self.day = year, month, day
@classmethod
def from_string(cls, date_string):
year, month, day = map(int, date_string.split('-'))
return cls(year, month, day)
@staticmethod
def is_valid_date(date_string):
parts = date_string.split('-')
return len(parts) == 3
What are dunder methods in Python?
Dunder methods (double underscore methods) are special methods that Python calls implicitly for built-in operations. They allow custom classes to integrate with Python's language features.
Common dunder methods: init is called when an object is created. repr and str control string representation. len enables len(obj). getitem enables obj[key]. iter and next make the object iterable. eq and lt enable comparison operators. add enables the + operator.
python
class Vector:
def __init__(self, x, y):
self.x, self.y = x, y
def __add__(self, other):
return Vector(self.x + other.x, self.y + other.y)
def __repr__(self):
return f"Vector({self.x}, {self.y})"
v1 = Vector(1, 2)
v2 = Vector(3, 4)
print(v1 + v2) # Vector(4, 6)
Python Gotchas Interviewers Probe
The mutable default argument trap
Default argument values in Python are evaluated once at function definition time, not each time the function is called. For mutable defaults like lists or dictionaries, this creates a shared object across all calls.
python
# Wrong: the same list is shared across all calls
def append_to(element, target=[]):
target.append(element)
return target
print(append_to(1)) # [1]
print(append_to(2)) # [1, 2] -- unexpected
# Correct: use None as default and create inside the function
def append_to(element, target=None):
if target is None:
target = []
target.append(element)
return target
This is one of the most commonly asked Python gotcha questions. Know it cold.
The difference between is and ==
== checks value equality. is checks identity: whether two variables refer to the exact same object in memory.
python
a = [1, 2, 3]
b = [1, 2, 3]
c = a
print(a == b) # True: same values
print(a is b) # False: different objects
print(a is c) # True: same object
Python caches small integers (-5 to 256) and short strings, which means is sometimes returns True for these even when you did not intend identity comparison. Always use == for value comparison.
What Interviewers Actually Score in Python Interviews
Python fluency is assumed at entry level. What interviewers at mid-level and above are actually evaluating is different.
They want to see Pythonic thinking: do you use list comprehensions, generators, and built-in functions naturally, or do you write Java-style for loops in Python? A candidate who writes a nested for loop to filter and transform a list when a single list comprehension would do it signals unfamiliarity with the language.
They probe memory and performance awareness: do you know when to use a generator instead of a list? Do you understand that appending to a list is O(1) amortised but inserting at index 0 is O(n)?
They evaluate concurrency reasoning: when do you use threading, when do you use multiprocessing, and when do you use asyncio? Being able to reason through this clearly without confusing the three is a strong signal at senior level.
FAQs
Is Python accepted for coding rounds at FAANG companies? Yes. Python is accepted at Google, Meta, Amazon, Apple, and Netflix for software engineering coding rounds. It is the most commonly used language in FAANG coding interviews due to its concise syntax and the speed advantage it gives in timed rounds.
What Python version should I target for interviews? Python 3. Be comfortable with Python 3.8 and above. Features like f-strings, walrus operator (:=), and type hints are fair game. Python 2 is fully deprecated and should not come up.
Do I need to know Django or Flask for Python interviews? For backend engineering roles, knowledge of at least one Python web framework is expected. Flask is simpler and appears more often in interview discussions. For pure algorithmic coding rounds, no framework knowledge is needed.
What is the most common Python topic candidates are under-prepared on? Generators and the GIL. Generators are underused by candidates who only think in lists. The GIL is frequently misunderstood. Both come up regularly from mid-level upward.
Summary
Python interviews test core language features, OOP, memory management, concurrency, and Pythonic thinking. Knowing how to code in Python is not enough. Interviewers probe why you made specific language choices and how your code behaves at scale.
Book a Python mock interview on Intervue.io to practice with an engineer who will push past the solution into the reasoning.




