Python Interview Rounds and What Interviewers Check
35 min · Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)Before you practise problems, learn what the interview is looking for. Then each hour of practice builds the right habits.
The rounds you may meet
A technical round is an interview where an engineer asks you to solve problems and explain Python ideas, often on a shared editor, a whiteboard or paper, and asks about your own projects.
A company picks freshers in several steps. The steps and their order differ from one company to another, so read the notice you are given.
rounds = [ ("online test", "speed, basics, hidden test cases"), ("technical interview", "depth, problem solving, your code"), ("managerial or HR", "teamwork, ownership, fit"),]for number, (name, checks) in enumerate(rounds, start=1): print(f"{number}. {name}: {checks}")Example 1 · A drive as a funnel (made-up numbers)
stages = [("Online test", 150), ("Technical round", 60), ("Managerial round", 45), ("HR round", 40)]entered = 600print(f"Applied: {entered}")for name, cleared in stages: print(f"{name:<17}{cleared:>4} of {entered:>3} cleared ({cleared / entered:.1%})") entered = clearedApplied: 600 Online test 150 of 600 cleared (25.0%) Technical round 60 of 150 cleared (40.0%) Managerial round 45 of 60 cleared (75.0%) HR round 40 of 45 cleared (88.9%)
What this code does
- These numbers are invented to show the shape, not data from a real company.
:.1%turns a fraction into a percentage with one decimal place. The share who clear each round rises, because early rounds are wide filters.
enumerate(rounds, start=1) numbers the rounds from 1, and the tuple in the for line is unpacked into two names. Early rounds remove many people cheaply; later rounds pick the best few.
What interviewers check
A signal is something an interviewer can see you do, such as splitting a problem into steps, explaining a choice, writing readable code or testing your own answer. Interviewers score signals, not only the final output.
An interviewer cannot see your mind. They see only what you say and write. Each thing they can see is a signal.
signals = { "problem solving": "breaks the question into steps", "communication": "explains choices aloud", "code quality": "clear names, small functions", "testing": "tries edge cases before being asked",}for name, evidence in signals.items(): print(f"{name:<16}{evidence}")Example 2 · Check your own answer against the signals
signals = ["restated the problem", "asked about edge cases", "explained the approach", "tested my code"]done = {"restated the problem": True, "asked about edge cases": False, "explained the approach": True, "tested my code": False}missing = [s for s in signals if not done[s]]print("Missing:", ", ".join(missing) if missing else "none")Missing: asked about edge cases, tested my code
What this code does
- The list comprehension keeps only the signals that are still
False. - Use this list after every practice problem: the gaps it shows are the habits to build next.
Looping over signals.items() gives each key and value together. A correct answer with no explanation shows only one signal; a clear plan with a small bug often shows all four.
A plain answer first, then a better one
Brute force means trying every possibility in the plainest way. It is usually correct but slow, and it is a good first answer to say aloud before you improve it.
Say the simplest working idea first. Then look for waste in it and improve it. This shows you can reach a correct answer and also tune it.
def has_duplicate_slow(values): for i in range(len(values)): for j in range(i + 1, len(values)): if values[i] == values[j]: return True return FalseExample 3 · Duplicate check: brute force, then a set
def has_duplicate_slow(values): for i in range(len(values)): for j in range(i + 1, len(values)): if values[i] == values[j]: return True return False
def has_duplicate(values): seen = set() for value in values: if value in seen: return True seen.add(value) return False
orders = [1042, 1043, 1044, 1042]print(has_duplicate_slow(orders), has_duplicate(orders))print(has_duplicate_slow([]), has_duplicate([]))True True False False
What this code does
- Both functions agree, including on an empty list. The first takes O(n squared) time and O(1) extra space; the second takes O(n) time and O(n) extra space.
- Say the trade out loud: the set spends memory to save time. That one sentence is what the interviewer is listening for.
The index loops are the point here: every pair is compared, so the time grows with the square of the list length. The better version, in the example below, remembers what it has seen in a set.
Edge cases to try before you are asked
An edge case is an input at the border of what a problem allows, such as an empty list, one item, repeated values or negative numbers, where a careless solution often breaks.
A sample input is only one case. Hidden tests and interviewers try the borders of the problem.
def second_highest(marks): distinct = sorted(set(marks), reverse=True) return distinct[1] if len(distinct) > 1 else NoneExample 4 · Edge cases for second highest
def second_highest(marks): distinct = sorted(set(marks), reverse=True) return distinct[1] if len(distinct) > 1 else None
cases = { "sample": [78, 91, 85, 91, 66], "all equal": [50, 50, 50], "one student": [72], "empty": [], "negatives": [-4, -9, -1],}for label, marks in cases.items(): print(f"{label:<12}{second_highest(marks)}")sample 85 all equal None one student None empty None negatives -4
What this code does
- Only the first case is likely to be shown in the question. The other four are the ones a hidden test uses.
- Returning
Nonefor "no answer" is a choice: ask the interviewer what they want here before you code.
set removes repeated marks, so two students on 91 do not count twice. The if handles an empty list, one student and all marks equal, where there is no second value.
Next step
Check your understanding
10 quick questions