Python Interview Questions

Python interview questions test your knowledge of data structures, mutability, list comprehensions, decorators, generators, and the Python standard library. Python shows up in backend, data, and automation roles alike, so interviewers look for clean, idiomatic code as much as correct answers. This page covers 40 real Python interview questions with answers across four formats: multiple choice, written answers, spoken responses, and live coding challenges, the same mix used in modern technical interviews.

Practice each question in your browser with no signup required. Answers stay hidden until you attempt the question: type, speak, or code your response first, then compare it against the model answer. Questions range from fundamentals for your first developer job to scenario-based questions for senior roles, so you can find the gaps in your knowledge before the real interview.

40 questions with answersLast updated: Oct 19, 2026
Start a mock interview

How to practice

  1. Choose a question. Pick any of the 40 questions. They mix multiple choice, written, spoken, and coding, the same mix a real interviewer uses.
  2. Attempt your answer. Select a multiple-choice option, type your written response, record a spoken answer, or write code in the editor.
  3. Reveal the model answer. Once you have attempted the question, the model answer unlocks so you can compare it with yours.
  4. Move to the next question. Track how many questions you have attempted with the progress bar at the top of the page.
  5. Take a mock interview. When you are ready, try a full mock technical interview on Plaicer with AI-driven follow-up questions.

Python Interview Questions and Answers

0 of 40 attempted
1Multiple choice

How would you characterize Python's approach to variable typing?

Attempt the question first to reveal the answer.

2Written answer

Describe the key differences between lists and tuples, including when each is appropriate to use

Attempt the question first to reveal the answer.

3Spoken answer

Walk through how you would debug a Python function that's returning incorrect results

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

4Coding

Write a function that reverses a string without using built-in reverse methods

def reverse_string(text):
    # Your implementation here
    pass

Attempt the question first to reveal the answer.

5Multiple choice

Given nums = [10, 20, 30]; ref = nums; nums.append(40); what does ref contain?

Attempt the question first to reveal the answer.

6Written answer

Explain Python's argument passing mechanism and the implications for mutable versus immutable objects

Attempt the question first to reveal the answer.

7Spoken answer

Explain a situation where you used list comprehension in real code and why it was better than the alternative

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

8Coding

Given a list of user ID numbers, identify which IDs appear more than once in the dataset

def find_duplicate_ids(user_ids):
    # Your implementation here
    pass

# Example usage:
ids = [101, 202, 101, 303, 202, 404]
# Should return [101, 202]

Attempt the question first to reveal the answer.

9Multiple choice

Which data structure cannot be modified after creation?

Attempt the question first to reveal the answer.

10Written answer

What are decorators in Python and provide an example of how they extend function behavior without modifying the original code

Attempt the question first to reveal the answer.

11Spoken answer

Describe how you'd explain the concept of mutability to a junior developer who's confused about list behavior

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

12Coding

Given a nested structure of customer orders where orders contain line items, flatten it into a single list of all line items

def flatten_orders(orders_structure):
    # Your implementation here
    pass

# Example:
orders = [['item1', 'item2'], ['item3', ['item4', 'item5']]]
# Should return ['item1', 'item2', 'item3', 'item4', 'item5']

Attempt the question first to reveal the answer.

13Multiple choice

What operation does the // symbol perform on integers?

Attempt the question first to reveal the answer.

14Written answer

Define mutability in Python and categorize common data types as mutable or immutable

Attempt the question first to reveal the answer.

15Spoken answer

How would you approach optimizing code that processes a large dataset and runs slowly

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

16Coding

Given a list of prices and a target total, find two prices that add up to the target. Return their indices

def find_matching_prices(prices, target):
    # Your implementation here
    pass

# Example:
prices = [25, 50, 75, 100]
target = 125
# Should return [1, 2] (indices where 50 + 75 = 125)

Attempt the question first to reveal the answer.

17Multiple choice

Using negative indexing, how would you retrieve the third item from the end of a list?

Attempt the question first to reveal the answer.

18Written answer

Explain the role of context managers in resource management and why they're important

Attempt the question first to reveal the answer.

19Spoken answer

Explain the difference between module-level scope and local scope with a practical example

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

20Coding

Generate the first n numbers in the Fibonacci sequence where each number equals the sum of the two preceding values

def generate_fibonacci(n):
    # Your implementation here
    pass

# Example:
# generate_fibonacci(6) should return [0, 1, 1, 2, 3, 5]

Attempt the question first to reveal the answer.

21Multiple choice

What boolean value does an empty list evaluate to?

Attempt the question first to reveal the answer.

22Written answer

Compare shallow and deep copying methods and explain when each should be used

Attempt the question first to reveal the answer.

23Spoken answer

How would you handle errors in a function that reads data from an external API

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

24Coding

Determine if a product SKU string is a valid palindrome (ignoring spaces, dashes, and case)

def is_valid_sku(sku):
    # Your implementation here
    pass

# Examples:
# is_valid_sku('A1B-2-B1A') should return True
# is_valid_sku('SKU-1234') should return False

Attempt the question first to reveal the answer.

25Multiple choice

What keyword brings external modules into your program?

Attempt the question first to reveal the answer.

26Written answer

Describe the variable lookup order Python follows when resolving names through the LEGB rule

Attempt the question first to reveal the answer.

27Spoken answer

Describe how you'd design a class to represent a bank account with proper encapsulation

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

28Coding

Merge two sorted lists of invoice amounts into a single sorted list without using built-in sort

def merge_invoice_lists(list1, list2):
    # Your implementation here
    pass

# Example:
# merge_invoice_lists([10, 30, 50], [15, 25, 40])
# Should return [10, 15, 25, 30, 40, 50]

Attempt the question first to reveal the answer.

29Multiple choice

When you use zip([1,2], ['x','y']), what structure is created?

Attempt the question first to reveal the answer.

30Written answer

What is list comprehension and what advantages does it offer over traditional iteration with loops

Attempt the question first to reveal the answer.

31Spoken answer

What approach would you take to write reusable code across multiple projects

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

32Coding

Given a log of transaction descriptions, count how many times each keyword appears (case-insensitive)

def count_keywords(descriptions):
    # Your implementation here
    pass

# Example:
# count_keywords('purchase sale Purchase refund Sale')
# Should return {'purchase': 2, 'sale': 2, 'refund': 1}

Attempt the question first to reveal the answer.

33Multiple choice

In Python, what is the purpose of the pass keyword?

Attempt the question first to reveal the answer.

34Written answer

Distinguish between value equality and identity comparison in Python using == and is operators

Attempt the question first to reveal the answer.

35Spoken answer

Explain how generators help with memory efficiency and when you'd use them instead of lists

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

36Coding

Remove all duplicate employee IDs from a list while preserving the original order of first occurrence

def remove_duplicate_employees(employee_ids):
    # Your implementation here
    pass

# Example:
# remove_duplicate_employees([1001, 1002, 1001, 1003, 1002])
# Should return [1001, 1002, 1003]

Attempt the question first to reveal the answer.

37Multiple choice

What is the safest way to verify a key is present in a dictionary?

Attempt the question first to reveal the answer.

38Written answer

What does self signify in instance methods and why must it be included as the first parameter

Attempt the question first to reveal the answer.

39Spoken answer

How would you approach learning and teaching a new Python feature or library to your team

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

40Coding

Write a function to transpose a database table (swap rows and columns)

def transpose_table(table):
    # Your implementation here
    pass

# Example:
# Input: [[1, 2, 3], [4, 5, 6]]
# Output: [[1, 4], [2, 5], [3, 6]]

Attempt the question first to reveal the answer.

Topics covered

  • Core concepts: dynamic typing, truthiness, operators, indexing
  • Built-in data structures: lists, tuples, dicts, sets
  • Mutability: mutable vs immutable types, argument passing
  • Copying and identity: shallow vs deep copy, == vs is
  • Scope: the LEGB rule, module-level vs local scope
  • Comprehensions: list comprehensions and when to use them
  • Decorators and context managers
  • Generators and memory efficiency
  • Object-oriented Python: classes, self, encapsulation
  • Problem-solving: strings, duplicates, merging, two-sum style challenges

Frequently asked questions

How many Python interview questions are on this page?
40 real Python interview questions across four formats: multiple choice (10), written answer (10), spoken answer (10), and coding (10).
Do I need to sign up to practice?
No. All 40 questions and model answers are free with no signup. You attempt each question first, and the model answer unlocks once you have engaged.
Who are these Python interview questions for?
Developers preparing for Python technical interviews at any level, from first job to senior engineer roles. Questions cover fundamentals through real-world scenarios.
What topics do the Python questions cover?
The questions cover core Python concepts, built-in data structures, and mutability. They also test scope, comprehensions, decorators, context managers, and generators. Coding tasks cover strings, duplicates, merging, and other common interview problems.
Can I practice coding questions in the browser?
Yes. Coding questions include starter code in an in-browser editor, so you can write your solution without installing anything.
How often are the questions updated?
The question bank is reviewed regularly and updated to reflect current Python interview patterns.
Can I take a full mock interview?
Yes. Plaicer's mock technical interview walks you through a realistic 30 to 45 minute interview with AI-driven follow-up questions.
Which Python version do the questions cover?
Python 3. Every question and model answer uses current Python 3 syntax and behavior.

Pick your language

View all programming interview questions

Need to run some Python code first?

Online Python Compiler

Reading answers is not the same as giving them. Sit a full mock interview and get scored on how you actually explain them.

Try a mock interview