In short
Tracy AI Interviewer can set a Python coding task inside the interview and follow up on approach and trade-offs, so you hear how a developer reasons about the code they wrote, not only whether it runs. Below are 15 Python interview questions with follow-ups. Start with question 1: "A function with an empty list as a default argument gives odd results after a few calls. Why?" You get the recording, the timestamped transcript and a written assessment per question from every result; your engineers make the call.
Say a Python role draws 300 applications. Every CV says Python, and the CV cannot tell you who has fixed a script that ran out of memory and who has only finished a course. Good Python interview questions ask what happened when a script that worked on a sample file met the real one.
Hiring managers, data leads and recruiters screening developers, analysts and data engineers can use these 15 Python interview questions. Keep the first conversation to 20 to 30 minutes and leave a live pairing session for your own team to run later.
Tracy AI Interviewer can run that first conversation, with a Python coding task inside it. After the candidate answers she asks about their approach and its trade-offs, which is where a script that only worked on a sample file shows its limits. For the wider process, see how Tracy runs a technical interview. For a data role that uses Python daily, see data engineer interview questions.
What should a Python interview test?
It should test how Python behaves under load and in messy data: memory, speed, errors and cleanup. Syntax recall is a warm-up.
Fifteen Python interview questions, grouped by what they test
Use one or two questions from every group. The follow-up comes after the first answer, never with it. Note what a good answer contains before the first interview.
Group 1: Language behaviour
1. A function with an empty list as a default argument gives odd results after a few calls. Why?
- Follow up with
- How would you rewrite it?
- Listen for
- Defaults are evaluated once, so the list is shared. Uses None and builds the list inside.
2. When do you use a generator instead of a list?
- Follow up with
- What is the catch?
- Listen for
- Memory and lazy work. One pass only, no indexing, harder to debug.
3. How do you choose between a list, a tuple, a set and a dict?
- Follow up with
- What can be a dict key, and why?
- Listen for
- Mutability, lookup cost, ordering. Keys must be hashable.
Group 2: Speed and scale
4. A script that reads a large file runs out of memory. What do you do?
- Follow up with
- What if you also need the data sorted?
- Listen for
- Read in chunks or stream. Sort in a database or an external sort. Measures memory first.
5. When would you reach for threads, processes or asyncio?
- Follow up with
- What does the GIL change about that choice?
- Listen for
- I/O-bound against CPU-bound work. In standard CPython, threads do not speed up CPU-bound work because of the GIL. Processes for CPU, asyncio for many connections.
6. A loop over 10 million rows takes minutes. How do you speed it up?
- Follow up with
- What do you check before you rewrite it?
- Listen for
- Profiles first. Vectorises with numpy or pandas, removes repeated work, picks the right structure.
Group 3: Structure and testing
7. How do you set up a small project so someone else can run it?
- Follow up with
- How do you handle dependencies?
- Listen for
- A virtual environment, pinned versions, one entry point, settings from the environment.
8. How do you test code that calls an external API?
- Follow up with
- What can a mock hide?
- Listen for
- pytest, fixtures, mocks at the boundary. Failure paths, and that a mock can drift from the real API.
9. How do you handle errors in a long-running script?
- Follow up with
- When is catching a broad exception acceptable?
- Listen for
- Specific exceptions, logs with context, retries with a limit. A bare except hides bugs.
Group 4: Data work
10. Two CSV files should match but do not. How do you find the difference?
- Follow up with
- What if the files are too large for memory?
- Listen for
- A key, a merge, counts first. Types and whitespace. Chunks, or a database.
11. A column holds dates in mixed formats. How do you clean it?
- Follow up with
- What do you do with the values you cannot parse?
- Listen for
- Explicit formats, no guessing on day against month. Logs and keeps the rejects, asks the owner.
12. Write a function that returns the first non-repeating character in a string.
- Follow up with
- What is its time and space cost, and what changes for a stream of characters?
- Listen for
- Counts with a dict or Counter, two passes, says the cost. Handles an empty string.
Group 5: Judgement
13. Tell me about a quick script that people came to depend on.
- Follow up with
- What did you add first?
- Listen for
- Tests, logging, an owner, a short README. Knew when it stopped being a quick script.
14. How do you decide between a library and writing it yourself?
- Follow up with
- How do you check a dependency before adding it?
- Listen for
- Maintenance, licence, size, security. Alternatives considered.
15. How do you review someone else's Python?
- Follow up with
- What do you let go?
- Listen for
- Correctness first, then readability. Formatting left to tools. Kind and specific.
Weak and strong answers to the same questions
Each row answers one question two ways.
Table 6: Weak and strong answers to the same questions, written as examples.
| Weak answer | Strong answer | |
|---|---|---|
| Question 1, the default list | "Never use mutable defaults." | "The default is created once when the function is defined, so every call shares it. I use None and make a new list inside the function." |
| Question 4, the large file | "I'd buy more memory." | "I'd stream it in chunks and keep only what I need. If it needs sorting, I'd load it into a database or sort in pieces and merge." |
| Question 13, the quick script | "It was never meant for production." | "A teammate scheduled it and relied on it. I added logging and a test on the two cases that broke, then wrote down how to run it." |
A follow-up chain on the file that will not fit
Nothing here is a real interview: the sample data and the candidate are made up. The chain starts from question 4.
Tracy: A script that reads a large file runs out of memory. What do you do? Candidate (fictional): I read the file in chunks instead of all at once. Tracy: What if you also need the rows sorted? Candidate: Sorting needs everything, so I would load it into a database and sort there, or sort chunks and merge them. Tracy: How would you check the sorted output is complete? Candidate: Compare the row count with the input and spot-check the first and last rows.

A second question built on the candidate's own answer shows whether chunking was the whole plan.
Run the Python interview for every applicant
Three hundred applications for one Python role would mean three hundred calls, which few teams can book.
- Set a coding task in the interview; Tracy follows up on approach and trade-offs. Question 12 works well as the task.
- Tracy drafts questions from the role description you give it; you edit them or replace them with your own. See where the questions come from.
- The candidate opens a link in a browser, with no account and no scheduling, at whatever hour suits them. Before it starts, the join screen says the conversation is recorded and transcribed. See the join screen and what follows.
- Every result has a recording and a timestamped transcript behind it, plus what the candidate said to each question and the result fields. See what an interview report contains.
- Integrity signals are on for video interviews unless you turn them off. They cover tab changes, gaze, face detection, delay before answers, fullscreen exits and external screens, and the evidence goes to a person. A signal is not proof.
There are no seats to buy. A credit costs $1 and covers each started 20 minutes of an interview that produced a result, and the first 3 results are free with no card. See pricing.

Your engineers can open the recording and the transcript behind each answer before they decide.
Keep three decisions with your engineers
- Who moves forward: a senior Python developer reads the report and decides. Tracy gives quoted evidence of what was said; the judgement is theirs.
- Calibration: pick one engineer and have them read five transcripts blind, then compare their read with the reviewer's. A gap means the questions need changing before you invite more people.
- The pairing round: reading and writing real code on your codebase stays with your team.
For two hires a year, a call with your own engineer is simpler; see when one engineer's call is enough. Past that, Tracy helps most where applicants outnumber your engineers' hours, as in volume hiring. To try it, put three of these questions into one open Python role and have an engineer read the first batch of reports. For the same approach on SQL, see SQL interview questions.
Common questions
What are good Python interview questions and answers?
What Python interview questions suit a data engineer?
What Python interview questions suit an experienced developer?
What Python questions suit 5 years of experience?
Can Tracy run a Python coding task in the interview?
Does Tracy decide who to hire?
Create an interview for this role
Create an interview for this exact role and read the report. The first 3 results are free.
Try it free (opens in a new tab) Book a demo (opens in a new tab)
Your first 3 results are free. No card needed.
Sources
- Tracy AI Interviewer home page, retrieved 14 Nov 2026.
- Tracy AI Interviewer pricing, retrieved 14 Nov 2026.
- Tracy AI Interviewer Connect page, retrieved 14 Nov 2026.



