The short answer: junior Python interviews check that you understand the core language (data types, mutability, lists, dictionaries, functions, classes, exceptions), can write clean code for small problems (string and list manipulation, counting, searching), and can explain your thinking. Expect a few concept questions, one or two live coding exercises, and questions about a project you built. Below are the most common questions with short answers and code, typical coding exercises, and how to prepare.
Data types and mutability
“What’s the difference between mutable and immutable types?”
Mutable objects can be changed in place (lists, dictionaries, sets); immutable ones can’t (integers, floats, strings, tuples, frozensets). Changing a string creates a new string.
“What’s the difference between a list and a tuple?”
Lists are mutable and usually hold items you’ll add to or change; tuples are immutable, slightly lighter, and can be used as dictionary keys if their contents are hashable.
“What’s the difference between == and is?”
== compares values; is checks whether two names refer to the same object. Use is for None: if x is None.
“How do dictionaries work, and what can be a key?”
They map keys to values using hashing, so lookups are fast on average. Keys must be hashable (immutable types such as strings, numbers or tuples of immutables).
The mutable default argument trap
A classic question. The Python tutorial warns: “The default value is evaluated only once.” So a mutable default is shared between calls:
def add_item(item, items=[]):
items.append(item)
return items
add_item(1) # [1]
add_item(2) # [1, 2] -- surprise!
The fix, as the tutorial shows:
def add_item(item, items=None):
if items is None:
items = []
items.append(item)
return items
Functions and comprehensions
“What are *args and **kwargs?”
*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dictionary.
“What is a list comprehension?”
A concise way to build a list:
squares = [n * n for n in range(10) if n % 2 == 0]
There are also dictionary and set comprehensions, and generator expressions with parentheses.
“What’s a lambda?”
A small anonymous function, often used as a key: sorted(people, key=lambda p: p["age"]).
Classes
“What’s the difference between a class and an instance?”
A class is the blueprint; an instance is an object created from it. __init__ sets up each instance’s attributes.
“What is self?”
The instance the method is called on, passed automatically as the first argument.
“What is inheritance?”
A class can reuse and extend another class’s behavior. Know how to call the parent’s method with super().
Errors and files
“How do you handle exceptions?”
try:
value = int(text)
except ValueError:
value = 0
finally:
print("done")
Catch specific exceptions, not a bare except:.
“Why use with when opening files?”
It closes the file automatically, even if an error occurs: with open("data.txt") as f:.
Iterators and generators
“What is a generator?”
A function that uses yield to produce values one at a time, so it doesn’t build the whole sequence in memory. Useful for large files or streams.
Common coding exercises
Practice these until you can write them cleanly and explain them:
- Reverse a string, and check if a string is a palindrome.
- Count how often each word appears in a sentence (with a dictionary or
collections.Counter). - Find duplicates in a list.
- FizzBuzz.
- Find the two numbers in a list that add up to a target.
- Merge two sorted lists.
- Remove duplicates from a list while keeping the order.
from collections import Counter
def top_words(text, n=3):
words = text.lower().split()
return Counter(words).most_common(n)
Talk through your approach first, write a simple correct solution, test it with a couple of examples including edge cases (empty input), and then mention how you could make it faster.
Questions about your projects
Juniors are often asked to walk through a project: what it does, why you built it, the hardest bug, what you’d do differently. Prepare one project you can explain in detail. See tell me about a time you solved a complex problem and describe your most challenging project.
How to prepare
- Review the Python tutorial sections on data structures, functions, classes and errors.
- Solve 20 to 30 easy problems out loud, explaining as you go.
- Write a small project you can talk about, with a README.
- Practice the behavioral questions too: “Tell me about yourself,” “Why this company?” See our common interview questions.
For live coding platforms, see our guides to HackerRank tests and CoderPad interviews.
Frequently asked questions
What Python questions are asked in a junior developer interview?
What is the mutable default argument problem in Python?
What's the difference between a list and a tuple in Python?
What coding exercises do junior Python developers get?
How do I prepare for a junior Python interview?
Sources
- Python Software Foundation, The Python Tutorial: More Control Flow Tools (Default Argument Values). Read on 1 October 2026.