One Word in the Prompt Decides This Interview
A mid-level Software Engineer sits down for a 30-minute Python interview. The task looks like warm-up: summarize some API logs per service. Then comes an easy-to-miss line: the input "may be a generator, not a list." Much of what follows, from how you aggregate to how you test, depends on whether you noticed it.
This walkthrough follows one real interview blueprint from the InterviewStack.io AI mock interview, the same scenario a live candidate faces for this role and topic. Dramatized answers below are illustrative, not a real transcript.
Key Findings
- The rubric totals 100 points: Interviewer Objectives Alignment and Level-Specific Expectations carry 30 points each, 60 of 100 combined.
- Technical Proficiency (accuracy of technical solutions) is worth 20 points, the same as Communication and Problem Solving.
- The interview runs 30 minutes in 3 phases: framing (0-6 min), implementation (6-22 min), and validation and trade-offs (22-30 min).
- Implementation is the longest phase at 16 minutes and carries 6 checklist items, more than either other phase.
- Phase 1 expects 2-4 clarifying questions or stated assumptions before any code is written.
- The expected complexity answer is linear time in the number of lines, with space proportional to the number of services (or service-endpoint keys), not the number of lines.
- 4 areas are explicitly out of scope, including machine learning modeling and database or SQL design, so a Python interview here means the language and standard library, not a library tour.

What Is a Software Engineer Python Interview Really Asking You to Build?
Here is the opening question, as the AI interviewer presents it.
The interview question
You are given an iterable of newline-delimited JSON strings representing API request logs from multiple services. The input may be a generator, some lines may be invalid JSON, some records may be missing fields, and the input can be large enough that loading everything into memory is undesirable.
# You are given an iterable of newline-delimited JSON strings representing
# API request logs from multiple services.
#
# Each line is expected to look like:
# {"timestamp":"2026-03-01T10:00:00Z","service":"payments","endpoint":"/charge","latency_ms":120,"status":200}
#
# In practice:
# - the input may be a generator, not a list
# - some lines may be invalid JSON
# - some records may be missing fields
# - the input can be large enough that loading everything into memory at once is undesirable
#
# Example input:
# lines = [
# '{"timestamp":"2026-03-01T10:00:00Z","service":"payments","endpoint":"/charge","latency_ms":120,"status":200}',
# '{"timestamp":"2026-03-01T10:00:01Z","service":"payments","endpoint":"/charge","latency_ms":250,"status":500}',
# '{"timestamp":"2026-03-01T10:00:02Z","service":"search","endpoint":"/query","latency_ms":80,"status":200}',
# 'not json',
# '{"timestamp":"2026-03-01T10:00:03Z","service":"payments","endpoint":"/refund","status":200}'
# ]
Using the log format above, implement a Python function that processes the input and returns a per-service summary that would be useful for an internal reliability dashboard.
The interviewer is probing five things: idiomatic Python, iterators and generators, clarifying ambiguous requirements, streaming instead of loading everything, and deliberate handling of malformed input. None of it needs a framework. It needs judgment about a single function.
Four Follow-Ups, Four Quiet Point Losses
The first answer is only the start; the follow-ups are where the checklist gets tested. Here are four of them, with a common mistake from a candidate we will call Tomas, and the stronger move.
Turn 1: Choosing the Summary Shape
Interviewer: "What fields would you include in the per-service summary, and how would you represent the return value in Python?"
Turn 2: Surviving a Huge Generator
Interviewer: "If the input is a one-pass generator with millions of lines, how would your implementation avoid unnecessary memory use?"
Turn 3: Bad Lines and Missing Fields
Interviewer: "How should invalid JSON, missing fields, or wrong types be handled, and what behavior would you choose for the summary?"
Turn 4: Testing With Few Cases
Interviewer: "How would you test this function using a few focused Python test cases?"
Spotting the Mistake Is the Easy Part
Reading these four boxes, each fix feels obvious. Live, it is not. You are typing, the clock is running, and the interviewer asks the next question before you finish defending the last one. We held back two follow-ups on purpose: adding the slowest endpoint per service without making the code hard to maintain, and splitting parsing from aggregation for reuse. Either one can arrive mid-answer. Knowing the checklist is not the same as hitting it under pressure, and the gap only closes with reps against unscripted follow-ups.
What Does a Strong 30 Minutes Look Like, Phase by Phase?
This is the blueprint a strong candidate hits, and the same one the AI mock interview tracks you against in real time. Phase 2 has the longest clock and the most checklist items (6), but Phases 1 and 3 each carry 4 items that are easy to skip while you are busy coding.

- ✓Asks 2-4 focused clarifying questions or states explicit assumptions
- ✓Defines a concrete return structure for per-service summary
- ✓Identifies at least one reliability-oriented metric beyond raw counts
- ✓Notes that input may be a generator and should be processed in one pass
- ✓Writes a function with a clear signature and coherent variable names
- ✓Parses each line with json from the standard library
- ✓Skips or accounts for malformed records in a defined way
- ✓Aggregates per-service state without storing all lines
- ✓Correctly updates count-based metrics and latency-based metrics when latency is present
- ✓Keeps code reasonably modular, for example separating parse and aggregate steps
- ✓Provides a small set of targeted test cases including malformed JSON and missing fields
- ✓States time complexity as linear in number of lines and space complexity as proportional to number of services or service-endpoint keys kept
- ✓Can describe a clean extension for tracking slowest endpoint per service
- ✓Explains at least one trade-off such as skipping bad records versus surfacing invalid counts
Run This Scenario Live, With Follow-Ups You Cannot Predict
Reading shows you the checklist. Practicing shows you whether you can produce it while someone is waiting. The AI mock interview runs this exact Python scenario, asks the follow-ups in real time, and scores you against the same four rubric dimensions.
Start the AI mock interview for this scenario
Want more reps first? Browse the Python question bank for Software Engineers and then come back for the live run.
FAQ
What does a mid-level Software Engineer Python interview actually test?
It tests whether you can write correct, idiomatic Python under realistic backend constraints: parse messy input, aggregate it in one pass, and explain your choices. The scenario here is a per-service summary over newline-delimited JSON request logs that may arrive as a generator.
How is this Python interview scored?
The rubric totals 100 points. Interviewer Objectives Alignment and Level-Specific Expectations carry 30 points each, Technical Proficiency carries 20, and Communication and Problem Solving carries 20. Technical Proficiency, which covers the accuracy of technical solutions, is worth 20 of the 100 points.
How long is the interview and how is the time split?
It runs 30 minutes in three phases: problem framing and contract definition (0-6 minutes), implementation (6-22 minutes, the longest at 16 minutes), and validation, extension, and trade-offs (22-30 minutes).
What should I do when the input is a generator with millions of lines?
Iterate once and keep only bounded aggregate state per service, such as counts, error counts, and a running latency total. Never convert the iterable to a list. The checklist expects space proportional to the number of services or service-endpoint keys, not the number of lines.
How should I handle invalid JSON or missing fields?
Pick one deliberate behavior and say it out loud. A common choice is to skip bad records but count them, so the dashboard can show data quality. The Phase 3 checklist explicitly rewards explaining the trade-off between skipping bad records and surfacing invalid counts.
Do I need pandas or machine learning libraries for this?
No. Machine learning modeling and feature engineering are explicitly out of scope here, and the blueprint never mentions pandas. The expected tools are the standard library json module, dictionaries, defaultdict or Counter, and small helper functions.
Can I practice this exact scenario?
Yes. The InterviewStack.io AI mock interview runs this Python scenario live, asks follow-ups in real time, and scores you against the same rubric and checklist covered in this walkthrough.
The Generator Was the Whole Test
If one detail from this scenario sticks, make it the generator. A candidate who notices it early, says the space bound, and handles bad lines on purpose has already satisfied most of what this interview checks. The rest is practice.
Topics
Ready to practice?
Put what you've learned into practice with AI mock interviews and structured preparation guides.