HomebaseWorks

Python basics interview questions

The questions junior Python candidates hear most, with answers you can say in under a minute.

EWritten by the HomebaseWorks editorial team · reviewed 26 Oct 2026
1
What is the difference between a list and a tuple?

A list is mutable and a tuple is not. Tuples are slightly faster, can be dict keys, and signal that the data should not change. Use a list when you will add or remove items.

2
What does 'b = a' do for a list?

It makes b another name for the same list. Changes through b show in a. To copy, use a.copy(), list(a) or a[:].

3
How do you handle an error without crashing?

try/except around the risky line, catching the specific exception, such as ValueError for int('abc'). Avoid a bare except, which hides bugs.

Advertisement
4
What is a dictionary and when do you use one?

A mapping from unique, hashable keys to values with fast lookup. Use it when you look things up by name or id rather than by position.

5
What is a list comprehension?

A compact way to build a list from an iterable with an optional condition: [n * n for n in range(5) if n % 2 == 0]. Prefer a plain loop when there are side effects.

6
Explain *args and **kwargs.

*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dict. They let a function accept a flexible number of arguments.

Practise out loud. Say each answer once as written, then again in your own words with your own number or story.

Have a number ready. "My Python score is at benchmark on a timed test" is a stronger answer than "I am good at it". Take the test and quote the result.

Advertisement
Continue with Python4 lessons · 2 interview sets · 1 test · 1 certificate
Not tested

More in Programming