← Back to videos

Mock interview with Alexander for a Junior Python developer position

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Passed interview Level: Junior

The candidate passed and meets the Junior Python Developer bar: he demonstrated solid theoretical grounding, clear jargon-free analogies, and thoughtful reasoning on tricky questions. His main growth area is hands-on experimentation—intentionally 'breaking' language constructs like return inside try/finally rather than trusting textbook happy paths.

Candidate: Alexander
Target role: Junior Python Backend

Economist with banking, sales & investment background · ~1 year studying Python (Yandex Practicum & books), no commercial IT experience

Answers accuracy 14 total
61% score
Theory
7/11 correct · 77%
Live coding
0/3 correct · 0%
Practical task
Not solved

Behavior of return and print statements inside try / finally blocks

Encountering 'return' inside try/finally for the first time, the candidate missed all three experiments: predicting 'test1' when both blocks returned, then guessing 'finally' runs before 'try', and predicting 'test1' would print before 'test2' when mixing return and print. Despite missing the exact frame-unwinding rule, he tested hypotheses methodically without freezing.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Solid Junior-level theory across functions, DRY, tuple returns, NoneType, and interpreters vs compilers
  • + Ability to explain technical concepts clearly through everyday, accessible analogies
  • + Transparent live reasoning and nuanced, non-dogmatic answers to provocative design questions
  • + Strong composure and articulate, well-structured communication throughout the interview

Areas to improve

  • → Go beyond textbook happy paths by actively experimenting with and breaking language constructs in the REPL
  • → Learn the exact execution order of try/finally when 'return' or an exception occurs inside 'try'
  • → Sharpen the distinction between object identity ('is' / id()) and value equality ('=='), including small-int caching
  • → Clarify standard CPython vs the Cython compiler, and how classes themselves are objects via metaclass 'type'

Questions in this interview

14 / 14
01 ▶ 03:47
What is a function in Python and what engineering problem does it solve (DRY principle)?
Theory Functions, scopes & closures
?
Candidate's answer

Noted that a function is an object encapsulating a single task and explained DRY vividly: isolating reusable logic avoids hunting bugs across duplicated lines.

Key takeaway

Functions provide decomposition, DRY reuse, isolated local namespaces, and clean unit-testing boundaries.

Open moment on YouTube ↗
#01
02 ▶ 05:33
How does a procedure differ from a pure function, and does Python have procedures?
Theory Functions, scopes & closures
?
Candidate's answer

Explained that pure functions compute and return output without side effects while procedures perform side effects like print(), implementable as regular Python functions.

Key takeaway

Python has no separate procedure keyword: every 'def' callable is a function that implicitly returns None when used purely for side effects.

Open moment on YouTube ↗
#02
03 ▶ 06:31
How does 'return' work, and what does a function return if 'return' is omitted or written bare without a value?
Theory Functions, scopes & closures
?
Candidate's answer

Correctly stated 'return' terminates function execution and both omitted and bare 'return' yield None, though loosely called 'return' a function rather than a statement.

Key takeaway

'return' is a control-flow keyword statement (not a function) that exits the current call frame and hands back an object—defaulting to None.

Open moment on YouTube ↗
#03
04 ▶ 08:46
Can a Python function return two values at once, and can one function contain multiple return statements?
Theory Functions, scopes & closures
?
Candidate's answer

Accurately explained that 'return a, b' returns a single tuple object, and multiple returns across branches are valid with only one executing per call.

Key takeaway

A function always returns a single object reference: 'return a, b' packs values into one tuple that callers can unpack.

Open moment on YouTube ↗
#04
05 ▶ 10:24
What does a function with 'try: return "test1"' and 'finally: return "test2"' return?
Live coding Exceptions & debugging
?
Candidate's answer

Predicted 'test1', reasoning that the first 'return' immediately terminates the function.

Key takeaway

Before a 'try' return or exception exits the function, Python runs 'finally'; a 'return' inside 'finally' overrides the pending return value (and silently swallows active exceptions).

Open moment on YouTube ↗
#05
06 ▶ 14:40
In what order are lines printed if 'try' has print('test1') and 'finally' has print('test2')?
Live coding Exceptions & debugging
?
Candidate's answer

Trying to rationalize the earlier result, hypothesized that 'finally' runs before 'try' and predicted 'test2' followed by 'test1'.

Key takeaway

Execution always enters 'try' first (followed by except/else as applicable) and runs 'finally' last during cleanup.

Open moment on YouTube ↗
#06
07 ▶ 17:26
What is the purpose of 'try / except / finally' and how do its clauses work together?
Theory Exceptions & debugging
?
Candidate's answer

Clearly explained that 'try' runs guarded code, 'except' catches runtime exceptions to prevent crashes, and 'finally' executes unconditionally.

Key takeaway

Python's try / except / else / finally separates risky operations, error recovery, success-only continuation, and guaranteed cleanup.

Open moment on YouTube ↗
#07
08 ▶ 21:05
What is printed and in what order for print(printer()) when 'try' has 'return "test1"' and 'finally' has 'print("test2")'?
Live coding Exceptions & debugging
?
Candidate's answer

Predicted 'test1' then 'test2', and struggled to explain why 'test2' printed inside 'finally' before the outer print() received 'test1'.

Key takeaway

When 'try' hits 'return "test1"', Python stashes 'test1', executes 'finally' (printing 'test2'), and only then returns 'test1' to the outer print().

Open moment on YouTube ↗
#08
09 ▶ 27:15
What is None in Python, and why is the absence of a value represented by an object?
Theory Data types, numbers & memory
?
Candidate's answer

Accurately stated that None is the sole instance of NoneType, explicitly representing the absence of a value within Python's everything-is-an-object model.

Key takeaway

Representing 'no value' as the singleton object None lets Python pass, store, and return empty results safely without raw C NULL pointers.

Open moment on YouTube ↗
#09
10 ▶ 28:35
How should you check for None, and how does 'is' differ from '=='?
Theory Data types, numbers & memory
?
Candidate's answer

Correctly recommended 'is None' for the None singleton and tied '==' to value equality, but mistakenly claimed two variables assigned 5 would evaluate 'a is b' to False.

Key takeaway

'is' checks memory identity (id(a) == id(b)) and cannot be overloaded, whereas '==' invokes __eq__(); CPython interns small ints [-5, 256], though code must still use '==' for values.

Open moment on YouTube ↗
#10
11 ▶ 33:11
How do a programming language, an interpreter, and a compiler differ?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Used a clear translator analogy to separate the language specification from an interpreter program executing code on the fly versus a compiler translating the entire program ahead of time.

Key takeaway

A language is a specification, while compilers and interpreters are runtime programs (CPython compiles source to bytecode first, then interprets that bytecode in its VM).

Open moment on YouTube ↗
#11
12 ▶ 36:55
How do CPython and Cython differ, and why do multiple Python implementations exist?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Explained the engineering trade-off between development speed and execution speed well, but confused reference CPython with the Cython compiler.

Key takeaway

CPython is the standard reference interpreter from python.org written in C, whereas Cython compiles statically annotated Python-like code into C extensions.

Open moment on YouTube ↗
#12
13 ▶ 42:47
What are objects and classes in Python, and is a class itself an object?
Theory OOP, classes & dunder methods
?
Candidate's answer

Vividly explained classes as blueprints and instances as built tools inheriting from object, but concluded that classes themselves are not objects.

Key takeaway

In Python, classes are live runtime objects too—specifically instances of the metaclass 'type'—so everything addressable in Python truly is an object.

Open moment on YouTube ↗
#13
14 ▶ 49:55
What are OOP and functional programming conceptually, and which paradigm does Python belong to?
Theory OOP, classes & dunder methods
?
Candidate's answer

Identified OOP and functional programming as programming paradigms and stated that Python is multiparadigm.

Key takeaway

A paradigm defines how programs structure state and behavior; Python's multiparadigm design supports imperative, OOP, and functional styles side by side.

Open moment on YouTube ↗
#14
Original video description & timecodes

This time I talked with Alexander, who came from the banking sector and recently started learning Python. In a question-and-answer format, we discussed:

- what functions and procedures are in Python, how return works;
- what the difference is between an interpreter and a compiler;
- what is an object in Python and how classes are arranged;
- the peculiarities of the try/except/finally construct;
- basic principles of OOP and functional approach,

and also analyzed a new code example.

At the end, I gave feedback to the candidate: what I liked, what strengths he has, and what to pay attention to in the future.

This format is as close as possible to a real interview. If you're preparing to search for your first job as a Python developer, this video will help you understand what to expect and what to pay attention to when preparing.

Timestamps:

00:00 Introduction
00:28 A few words about the interviewer and candidate
03:47 Theoretical questions
10:35 Code experiments and questions about them
27:14 Continuation of theoretical questions
51:50 Feedback exchange

#python #junior #interview #interview #programming #development

On this channel I conduct mock interviews for the role of Python developer for anyone interested. This is a great opportunity to prepare for a real interview, improve your skills, get useful tips and honest feedback. I do all of this absolutely for free. However, maintaining quality requires significant time and resources. If you like my content and want to support the channel, I'll be grateful for any financial support.

https://yoomoney.ru/to/4100119163947822
https://www.tbank.ru/cf/4PYyn4udS41