1. What are Python’s key features?
Interpreted
High-level
Dynamically typed
Object-oriented
Extensive standard library
Platform independent
2. What is the difference between a list and a tuple?
list is mutable, tuple is immutable
list has more methods, slightly slower due to mutability
Use tuple when data should not change
3. What is a dictionary in Python?
An unordered, mutable collection of key-value pairs.
Defined with {}, keys must be immutable (e.g., strings, numbers, tuples).
4. What is list comprehension?
A concise way to create lists:
squares = [x**2 for x in range(10)]
5. What is the difference between is and ==?
== checks value equality
is checks object identity
a = [1,2]; b = [1,2]
a == b → True
a is b → False
6. **What are *args and kwargs?
*args collects positional arguments into a tuple
**kwargs collects keyword arguments into a dictionary
7. What is a Python generator?
A function that yields values one at a time using yield, saving state between calls.
Efficient for large datasets.
8. What is the difference between @staticmethod and @classmethod?
@staticmethod: no access to class or instance (self or cls)
@classmethod: receives class (cls) as first argument
9. What is the Global Interpreter Lock (GIL)?
A mutex in CPython that allows only one thread to execute Python bytecode at a time.
Limits multi-threaded performance.
10. What is the difference between deep copy and shallow copy?
Shallow copy copies object references
Deep copy copies everything recursively
Use copy.copy() and copy.deepcopy()
11. What is Pythonic code?
Code that follows idiomatic Python conventions:
Readable, clean, uses list comprehensions, unpacking, EAFP, etc.
12. What is the difference between range() and xrange()?
Python 3: xrange() is removed
range() returns an iterable (like xrange() did in Python 2)
13. What is the difference between a module and a package?
Module: a single .py file
Package: a folder with init.py and other modules
14. Explain duck typing in Python.
“If it walks like a duck and quacks like a duck, it’s a duck.”
Python cares about behavior (methods), not type.
15. What are Python decorators?
Functions that modify behavior of another function or method.
Example:
@my_decorator
def hello(): pass
16. What is the difference between del, remove(), and pop()?
del deletes by index or variable
remove() deletes by value
pop() removes and returns item by index
17. What are Python’s data types?
Numeric: int, float, complex
Sequence: list, tuple, range
Mapping: dict
Set: set, frozenset
Boolean: bool
Text: str
18. What is the difference between None and False?
None is the absence of a value (null)
False is a Boolean
None != False, but both are falsy in conditionals
19. What is the with statement used for?
Context manager. Automatically handles setup and teardown (e.g., closing files):
with open('file.txt') as f:
data = f.read()
20. What is the difference between str() and repr()?
str() → user-friendly string
repr() → unambiguous developer-focused string (can recreate object if possible)
📘 Want to Ace Your Python Interviews?
These 20 questions are just the beginning.
We created a full guide with 500+ Python questions, complete with code examples, explanations, and bonus behavioral prep.
🎁 Download Free Sample – Python Interview Handbook
📚 Get the Full Book Now – Python Interview Handbook
✅ Includes:
Beginner to advanced questions
Real company interview patterns
Practice tasks + solutions
Find more interviewing ebooks on interviewbible.com
Top comments (0)