Python is the primary language for data engineering, machine learning, and backend development at Indian product companies and startups. Backend engineers at Swiggy, Zomato, and Meesho, and virtually all ML and data science roles across Indian tech are Python-first. This guide covers the Python interview questions asked at Indian product companies across experience levels.
Core Python Fundamentals
Fundamentals tested at every level: Python data types: int, float, str (immutable), list (mutable ordered), tuple (immutable ordered), dict (mutable key-value, ordered since Python 3.7+), set (mutable unordered unique). Mutable vs immutable: lists and dicts are mutable (can be changed in-place), strings and tuples are immutable (operations return new objects). Pass by assignment: Python passes object references. Mutables can be modified inside functions; reassignment does not affect the caller. List vs tuple: use tuples for fixed collections (coordinates, RGB values), lists for dynamic collections. dict.get(key, default) vs dict[key]: get() returns default if key missing; [] raises KeyError. Walrus operator (:=) Python 3.8+: while chunk := f.read(8192).
OOP and Advanced Patterns
OOP in Python: classes, _init, instance vs class variables, @classmethod (receives class, not instance), @staticmethod (no implicit first arg). Dunder methods: str (human-readable), repr (developer-readable, unambiguous), len, getitem, eq. Inheritance: super() to call parent. Multiple inheritance and MRO (Method Resolution Order): C3 linearisation. Property: @property for getter, @setter for setter: controlled attribute access. Decorators: functions that take a function and return a modified function. Used for logging, timing, caching (functools.lrucache), access control. Generator functions: use yield instead of return. Lazy evaluation: produces values on demand. Memory efficient for large sequences. Generator expressions: (x2 for x in range(1000)) vs list comprehension [x2 for x in range(1000)].
Python Interview Patterns
Patterns that appear repeatedly in Python interviews at Indian product companies: Counter from collections: from collections import Counter. Counts hashable objects in one line. Counter(word for word in text.split()). defaultdict: avoids KeyError for missing keys. defaultdict(list) for grouping. heapq: Python min-heap. heapq.nlargest(k, items) for top-k problems. bisect: binary search on sorted lists. sorted() with key: sorted(students, key=lambda s: (-s.grade, s.name)). zip and enumerate: for i, (a, b) in enumerate(zip(list1, list2)). any() and all(): any(x > 0 for x in nums). String methods: join, split, strip, replace, startswith, endswith. f-strings (Python 3.6+): f{name} is faster and cleaner than format() or %.
Python interviews reward pattern recognition and clear explanation. Practise articulating your solutions with HireStepX before your next coding round.
Practice freeAsync Python and Common Pitfalls
Async Python: asyncio for concurrent I/O-bound operations. async def defines a coroutine. await suspends execution until the awaitable completes. asyncio.gather() runs coroutines concurrently. Used heavily in: web frameworks (FastAPI), high-throughput microservices, data pipelines with concurrent API calls. Python pitfalls tested in interviews: Mutable default arguments: def append(item, lst=[]) is a bug: default list is shared across calls. Use def append(item, lst=None): if lst is None: lst = []. Late binding closures: variables in lambdas are evaluated at call time, not definition time. GIL (Global Interpreter Lock): Python GIL prevents true multi-threading for CPU-bound work. Use multiprocessing for CPU-bound, asyncio/threading for I/O-bound. Memory leaks: circular references with _del_ methods, large lists kept in module scope.
Frequently asked questions
Practice these questions on HireStepX