Basics (Every Interview)
- list vs tuple? — mutable vs immutable; tuples for fixed records/keys.
- What are decorators? — functions wrapping functions (@timer, @login_required).
- args vs kwargs? — *args positional tuple, **kwargs keyword dict.
- Shallow vs deep copy? — copy.copy shares nested refs; copy.deepcopy clones all.
- What is PEP 8? — style guide; mention flake8/black usage.
- is vs ==? — identity vs equality.
OOP + Intermediate
- self explained? — instance reference; first param of methods.
- Inheritance vs composition? — is-a vs has-a; prefer composition.
- What are generators? — lazy iterators via yield; memory-efficient loops.
- List comprehension vs map? — readability + speed for transforms.
- @staticmethod vs @classmethod? — no instance access vs class access.
Pandas + Data (Analyst Rounds)
- DataFrame vs Series? — 2D table vs 1D column.
- merge vs join vs concat? — SQL-style, index-based, stacking.
- How to handle missing values? — dropna/fillna by context; never silent mean-fill dates.
- groupby-apply pattern? — split-apply-combine; give a sales example.
- Vectorisation? — avoid row loops; use NumPy/Pandas ops.
Tricky + HR
- GIL? — one bytecode thread at a time; use multiprocessing for CPU work.
- Explain your best project in 2 minutes — problem → approach → metric → your role.
- Why data roles? — tie past + portfolio, not salary.
90-Day Prep Plan
Days 1–30: basics + OOP + 100 practice problems. Days 31–60: Pandas + 2 projects. Days 61–90: mocks (record yourself), revise GIL/decorators/generators weekly. Practice live: Python compiler. Full prep: ML interview prep.
10 More Rapid-Fire Questions (With Answers)
- Walrus operator? — := assigns inside expressions (if (n := len(x)) > 5).
- * unpacking? — a, *b = [1,2,3] → b=[2,3]; also f(*args).
- dict comprehension? — {k: v for k,v in pairs} — one-line dict builds.
- try/except/else/finally? — else runs if no exception; finally always (cleanup).
- Why virtualenv? — Isolated deps per project; avoids version clashes.
- __name__ == "__main__"? — True only when file runs directly — guards script code on import.
- Mutable default arg gotcha? — def f(x=[]) shares one list — use None + create inside.
- enumerate + zip? — Loop with index (enumerate) and parallel lists (zip).
- strip/split/join? — Clean, tokenise, rejoin strings — daily data cleaning trio.
- pip freeze? — Snapshots exact versions for requirements.txt reproducibility.
7-Day Revision Plan
- Day 1–2: definitions aloud (record yourself, 2-min each).
- Day 3–4: 1 project end-to-end narration.
- Day 5: full mock with a friend/mentor.
- Day 6: fix weak answers only.
- Day 7: rest + revise flashcards. Sleep beats cramming.
Annotated Mock Round (Analyst, 15 min)
- "Rate your Python." → Never "8/10". Say: "Strong in Pandas/SQL-automation; here's a 200-line EDA I shipped" + link. Why it works: proof over rating.
- Live: "Dedupe these customers, keep latest." → Think aloud: "Window ROW_NUMBER() in SQL, or drop_duplicates(subset, keep='last') in Pandas — I'd ask which source of truth." Scores process.
- "Your script is slow on 5M rows — fix?" → "Profile first; vectorise loops; chunk reads; push filters to SQL." Shows production thinking.
- "Explain groupby to a manager." → "Split rows into buckets, summarise each — like pivot tables that scale." Translation skill = promotion skill.
Frequently Asked Questions
- How many Python questions are asked in data interviews?
8–15 per round: 40% basics/OOP, 40% Pandas, 20% project discussion. - Is Python enough for data analyst interviews?
Plus SQL + Power BI + 1 dashboard project — Python alone rarely suffices. - Toughest Python topic?
Decorators/generators + Pandas edge cases; practice out loud. - Best way to revise before interview day?
Your own project READMEs + 20 flashcards of definitions.
Read also: Learn Python · SQL Questions · Interview Guide
Crack Python Rounds With Mentors
Mock interviews + project reviews. ₹4,999 onwards.
View Python Course →