Growzical logo

Python Interview Bundle

Most Purchased

Fundamentals, DSA, OOPs, libraries, async, and production - with working code and company-specific sets from Amazon, TCS, Wipro, and more.

4.9 (214 ratings)1,400+ purchased40% OFF todayInstant PDF deliveryLifetime access

What's Inside

Click any folder to see exactly what's inside.

Python Cheat SheetPDF

Syntax, patterns, gotchas - one page, printable

HR Interview Questions125 questions

Most asked HR questions for developer / data roles, with model answers

Python RoadmapPDF

Step-by-step path from basics to advanced Python

DSA Patterns in PythonPDF

Top 10 patterns - sliding window, two pointers, BFS/DFS

ATS-Friendly Resume TemplateDOCX

Tested template for Python / backend roles

WhatsApp CommunityLifetime Access

Job alerts, peer support, direct Q&A

Company coverage at a glance

Amazon50 Q&As
DSA in PythonOOPsComplexity
Infosys50 Q&As
Core fundamentalsOOPsScripting
Mphasis50 Q&As
Data structuresStringsOOPs
Oracle50 Q&As
OOPsDecoratorsDB connectivity
TCS50 Q&As
Core fundamentalsControl flowBasic DSA
Tech Mahindra50 Q&As
FunctionsException handlingFile handling
Wipro50 Q&As
OOPsGeneratorsStandard library
Price goes back up soon

Lock in ₹297 before the offer ends

Instant PDF delivery to your inbox - start preparing today.

Buy Bundle - ₹297

Instant PDF · Secure payment · Lifetime access

Sample Q&A

DecoratorsAsked at Oracle

Implement a memoize decorator that caches function results.

A closure keeps the cache dict alive between calls. Use *args as the key - lists aren't hashable but tuples are:

def memoize(fn):
    cache = {}
    def wrapper(*args):
        if args not in cache:
            cache[args] = fn(*args)
        return cache[args]
    return wrapper

@memoize
def fib(n):
    if n <= 1: return n
    return fib(n - 1) + fib(n - 2)
DSAAsked at Amazon

Find all pairs in a list that sum to a target value.

Use a set to track seen numbers - O(n) time instead of the O(n²) brute-force nested loop:

def find_pairs(nums, target):
    seen = set()
    pairs = []
    for n in nums:
        complement = target - n
        if complement in seen:
            pairs.append((complement, n))
        seen.add(n)
    return pairs
FundamentalsAsked at Amazon

What happens if you modify a list while iterating over it in Python? How do you handle it safely?

Modifying a list while iterating over it can skip elements or throw a RuntimeError, because the iterator tracks a position by index while the list's length shifts under it. The safe fix is to iterate over a copy of the list (or build a new list) instead of mutating the original mid-loop.

# Unsafe: indices shift as items are removed, so elements get skipped
nums = [1, 2, 3, 4, 5, 6]
for n in nums:
    if n % 2 == 0:
        nums.remove(n)

# Safe: iterate over a copy, mutate the original
nums = [1, 2, 3, 4, 5, 6]
for n in nums[:]:
    if n % 2 == 0:
        nums.remove(n)

# Safer & clearer: build a new list instead of mutating in place
nums = [1, 2, 3, 4, 5, 6]
nums = [n for n in nums if n % 2 != 0]
OOPAsked at Amazon

What are dunder/magic methods in Python? Provide three real-world use cases.

Dunder (double underscore) methods like __init__, __str__, and __len__ let a class hook into Python's built-in syntax instead of exposing separate named methods. __init__ customizes object creation, __str__ controls how an object prints, and __len__ lets len() work on your own objects.

class Cart:
    def __init__(self, items):   # custom object creation
        self.items = items

    def __str__(self):           # custom string representation
        return f"Cart with {len(self.items)} item(s)"

    def __len__(self):           # custom length
        return len(self.items)

cart = Cart(["pen", "notebook"])
print(cart)        # Cart with 2 item(s)
print(len(cart))   # 2
Data StructuresAsked at Amazon

How do you implement a double-ended queue (deque) in Python?

Use collections.deque - it supports adding and removing from both ends in O(1) time, unlike a list where removing from the front is O(n). That makes it the standard choice for LRU caches, BFS traversal, and sliding-window problems.

from collections import deque

dq = deque([2, 3, 4])
dq.appendleft(1)   # add to the front - O(1)
dq.append(5)       # add to the back - O(1)
dq.popleft()       # remove from the front - O(1)
dq.pop()           # remove from the back - O(1)
print(dq)          # deque([2, 3, 4])
FundamentalsAsked at Wipro

What is the difference between is and == in Python?

== compares values for equality, while is compares identity - whether two names point to the exact same object in memory. Two equal-looking lists can be different objects, so use == to compare values and is only when you specifically need an identity check, like x is None.

a = [1, 2, 3]
b = [1, 2, 3]
c = a

print(a == b)   # True  - same values
print(a is b)   # False - different objects in memory
print(a is c)   # True  - c refers to the same object as a
OOPAsked at Wipro

What is the difference between staticmethod and classmethod?

A classmethod receives the class itself as its first argument (cls) and can read or modify class-level attributes, which makes it useful for alternate constructors. A staticmethod takes no implicit first argument at all - it behaves like a plain function that happens to live inside the class, for logic that doesn't need class or instance data.

class Pizza:
    total_made = 0

    @classmethod
    def margherita(cls):
        cls.total_made += 1
        return cls("Margherita")

    @staticmethod
    def is_valid_size(size):
        return size in ("small", "medium", "large")

    def __init__(self, kind):
        self.kind = kind

Pizza.margherita()
print(Pizza.total_made)             # 1
print(Pizza.is_valid_size("large")) # True
AlgorithmsAsked at Wipro

Implement Dijkstra's Algorithm in Python.

Dijkstra's algorithm finds the shortest path from a source node to every other node in a weighted graph with non-negative edges. A min-heap always pops the closest unvisited node next, giving an O((V + E) log V) runtime.

import heapq

def dijkstra(graph, start):
    distances = {node: float("inf") for node in graph}
    distances[start] = 0
    heap = [(0, start)]

    while heap:
        dist, node = heapq.heappop(heap)
        if dist > distances[node]:
            continue
        for neighbor, weight in graph[node]:
            new_dist = dist + weight
            if new_dist < distances[neighbor]:
                distances[neighbor] = new_dist
                heapq.heappush(heap, (new_dist, neighbor))

    return distances

graph = {
    "A": [("B", 4), ("C", 1)],
    "B": [("D", 1)],
    "C": [("B", 2), ("D", 5)],
    "D": [],
}
print(dijkstra(graph, "A"))  # {'A': 0, 'B': 3, 'C': 1, 'D': 4}
FundamentalsAsked at Tech Mahindra

How does string interning optimize memory usage in Python?

String interning stores only one copy of an identical string and lets every reference point to that same object instead of duplicating it. Short, identifier-like strings are interned automatically; you can force it for any string with sys.intern(), which saves memory and makes equality checks a fast identity comparison instead of a character-by-character one.

import sys

a = "hello"
b = "hello"
print(a is b)  # True - short literals are auto-interned

c = "hello world!"
d = "".join(["hello", " world!"])  # built at runtime, not a literal
print(c is d)  # False - not auto-interned

c = sys.intern(c)
d = sys.intern(d)
print(c is d)  # True - now forced to share the same object
Dynamic ProgrammingAsked at Tech Mahindra

Given two strings, find the minimum edit distance (Levenshtein Distance).

Build a DP table where cell (i, j) holds the minimum edits to turn the first i characters of one string into the first j characters of the other. Matching characters carry the diagonal value forward for free; a mismatch costs 1 plus the best of an insert, delete, or replace - giving an O(M*N) solution.

def edit_distance(word1, word2):
    m, n = len(word1), len(word2)
    dp = [[0] * (n + 1) for _ in range(m + 1)]

    for i in range(m + 1):
        dp[i][0] = i
    for j in range(n + 1):
        dp[0][j] = j

    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if word1[i - 1] == word2[j - 1]:
                dp[i][j] = dp[i - 1][j - 1]
            else:
                dp[i][j] = 1 + min(
                    dp[i - 1][j],      # delete
                    dp[i][j - 1],      # insert
                    dp[i - 1][j - 1],  # replace
                )

    return dp[m][n]

print(edit_distance("kitten", "sitting"))  # 3

What is Python's MRO and how does super() actually use it?

1500+ more inside the full bundle

Reviews

IR

Ishita Rao

B.Tech, Mumbai University - Placed at Wipro

The decorator section is the best explanation I've ever read. It clicked in 20 minutes.

FAQs

Which Python topics are covered?

Fundamentals, Pythonic idioms, data structures & algorithms, OOPs, functional programming, popular libraries (NumPy, pandas, Django, FastAPI), async & parallel programming, production deployment, and performance debugging - everything that shows up in real interview rounds.

How is this different from free resources?

Free resources are scattered and inconsistent. This bundle has 1500+ Q&As organised by topic and company, with working code in every answer, plus a DSA patterns guide and resume template.

I have a product company interview next week - enough time?

Yes. Focus on the company-specific set, then OOPs and DSA. Most product-company Python rounds test a small set of patterns repeatedly, and this bundle has all of them.

Do I need to know Python basics before buying?

Basic familiarity helps, but the bundle starts from fundamentals and builds up - even a recent learner can follow along.

What format is everything delivered in?

All content is delivered as PDFs to your email immediately after purchase. The resume template is a DOCX file. Download once, own it forever.

Price goes back up soon

Lock in ₹297 before the offer ends

Instant PDF delivery to your inbox - start preparing today.

Buy Bundle - ₹297

Instant PDF · Secure payment · Lifetime access

Ready to get interview-ready?

1,400+ students already use this bundle to prepare.

Buy Bundle - ₹297

This is a digital product delivered instantly by email. Since delivery is instant, refunds aren't offered by default - reach out if something goes wrong and we'll make it right.

297499

one-time

Buy Bundle