← Back to videos

Public mock interview with Chingiz for a Junior Python developer position

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Needs more practice Level: Pre-Junior / Intern (coding intuition ahead of Python theory)

The candidate did not pass yet: despite calm delivery and solid code-reading instincts, systematic gaps surfaced in Python theory (conflating namespaces with scopes, carrying over block-level loop/if scoping from JS/C++, missing NoneType and metaclasses) alongside answering 'how' mechanics work instead of 'why' they exist.

Candidate: Chingis
Target role: Junior Python Backend

Intern developer at a software lab · studied C++ in college, Ruby on Rails in bootcamp, and React/Vue frontend, transitioning to Python backend

Answers accuracy 13 total
50% score
Theory
2/9 correct · 44%
Live coding
2/4 correct · 62%
Practical task
Partially solved

Nested functions outer/inner, closures, and pass / ... / None stubs

The candidate read the nested outer(x)/inner() code well: he caught 'return inner' without parentheses, predicted <function ...>, and got 4 upon calling result(). However, he initially mispredicted 5 when mutating an outer variable after closure creation, and struggled to articulate the syntactic role of 'pass' versus bare expression statements like '...' or None.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Calm, confident demeanor throughout follow-up and challenging questions
  • + Strong code reading: accurately traced nested functions, returning an uncalled function object, and invoking a closure
  • + Broad general development awareness from prior exposure to C++, Ruby, and JavaScript
  • + Clear practical explanation of when to choose for vs while loops

Areas to improve

  • → Systematize Python-specific scoping rules, separating them from C++ and JavaScript block scopes
  • → Focus on answering 'why' and 'when to use' a construct rather than only describing 'how' it is written
  • → Clarify namespace vs scope, and practical use cases for closures versus global/nonlocal
  • → Deepen understanding of Python's object model: NoneType, the 'type' metaclass, and how classes create objects

Questions in this interview

13 / 13
01 ▶ 04:41
What loop constructs exist in Python, and how do for and while differ?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Named for and while (noting comprehensions also use for), explaining that for traverses an iterable's elements whereas while repeats as long as a condition holds.

Key takeaway

Python provides only two loop statements—for and while—while comprehensions and map/filter iterate via the iterator protocol under the hood.

Open moment on YouTube ↗
#01
02 ▶ 07:46
How should a developer choose between a for loop and a while loop for a given task?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Explained that for is ideal for iterating collections without manual index bookkeeping, while while fits open-ended loops awaiting an external state change.

Key takeaway

Prefer 'for' over manual index loops to prevent off-by-one bugs; reserve 'while' for event loops, polling, or algorithms with dynamic termination conditions.

Open moment on YouTube ↗
#02
03 ▶ 12:33
What is a namespace, and what scope levels exist in Python?
Theory Functions, scopes & closures
?
Candidate's answer

Correctly listed all four LEGB levels (local, enclosing, global, built-in) and lookup order, but equated namespace directly with scope.

Key takeaway

Name resolution follows LEGB (Local -> Enclosing -> Global -> Built-in), backed at runtime by namespace mappings from names to objects.

Open moment on YouTube ↗
#03
04 ▶ 14:06
Are 'namespace' and 'scope' synonyms or distinct concepts in Python?
Theory Functions, scopes & closures
?
Candidate's answer

Concluded after hesitation that namespace and scope mean the same thing, unable to articulate how they differ.

Key takeaway

A namespace is the concrete dictionary mapping names to objects, whereas a scope is the lexical region of code where those names are directly accessible.

Open moment on YouTube ↗
#04
05 ▶ 17:05
How is a new namespace created in Python, and do 'for' loops or 'if/else' blocks create their own scope?
Theory Functions, scopes & closures
?
Candidate's answer

Correctly named functions and classes, then mistakenly carried over JS/C++ rules, claiming 'for' loops and 'if/else' blocks isolate variables inside their block.

Key takeaway

Unlike C++ or JS let/const, Python has no block scope for if, for, while, or try/with: variables bound inside them live in the enclosing function or module scope.

Open moment on YouTube ↗
#05
06 ▶ 19:20
Does a list comprehension create its own isolated namespace?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Correctly answered yes, but justified it with the mistaken assumption that regular 'for' loops also create an isolated scope.

Key takeaway

In Python 3, comprehensions have their own implicit local scope so loop variables do not leak into the surrounding namespace (unlike regular 'for' loops).

Open moment on YouTube ↗
#06
07 ▶ 20:59
How does nested inner() resolve parameter x from outer(x), and what does round(x) do?
Live coding Functions, scopes & closures
?
Candidate's answer

Traced outer and inner namespaces step by step, explaining that inner looks up x in the enclosing scope of outer and rounds it via round().

Key takeaway

Nested functions resolve free variables from the enclosing scope (E in LEGB), and Python 3's round() uses round-half-to-even (banker's rounding).

Open moment on YouTube ↗
#07
08 ▶ 26:47
What does print(result) output for result = outer(3.7) when outer ends with 'return inner', and how do you get the rounded number?
Live coding Functions, scopes & closures
?
Candidate's answer

Spotted the missing parentheses on 'return inner', predicted <function outer.<locals>.inner ...>, and added parentheses result() to get 4.

Key takeaway

'return inner' returns the callable function object carrying its closure cells, deferring execution until 'result()' is explicitly called.

Open moment on YouTube ↗
#08
09 ▶ 28:02
Why does the closure still use the captured value from outer(...) instead of updating to 5?
Live coding Functions, scopes & closures
?
Candidate's answer

Initially predicted 5, then realized after execution that the enclosing scope variable captured during outer() remained unchanged.

Key takeaway

Each call to outer(x) allocates an independent cell in inner.__closure__ holding the binding from that specific invocation.

Open moment on YouTube ↗
#09
10 ▶ 30:32
What is a closure and why use it in practice when Python already has global and nonlocal?
Theory Functions, scopes & closures
?
Candidate's answer

Correctly explained retaining enclosing variable references after outer returns and suggested a counter, but couldn't contrast closures with global/nonlocal.

Key takeaway

Closures power decorators and function factories with encapsulated per-instance state without polluting globals, whereas 'nonlocal' enables rebinding that captured variable.

Open moment on YouTube ↗
#10
11 ▶ 36:47
What happens if a function body contains '...', a number, or None instead of 'pass', and why does 'pass' exist?
Live coding Control flow, loops & syntactic sugar
?
Candidate's answer

Gave a good real-world example of 'pass' in empty CRUD subclasses, wasn't sure bare literals work without error in a function body, and viewed 'pass' purely as a readability hint.

Key takeaway

While bare expressions (..., None, docstrings) satisfy non-empty block syntax, 'pass' is a dedicated no-op statement that evaluates no object and clearly signals an intentional no-op.

Open moment on YouTube ↗
#11
12 ▶ 43:19
What is None in Python, when is it returned implicitly, and what class is it an instance of?
Theory Data types, numbers & memory
?
Candidate's answer

Correctly explained implicit None returns and checking empty DB fields, but mistakenly said None is an instance of class 'None' rather than 'NoneType'.

Key takeaway

None is the unique singleton instance of built-in class NoneType (types.NoneType), which inherits from object.

Open moment on YouTube ↗
#12
13 ▶ 47:05
If everything in Python is an object and objects are created from classes, where do classes themselves come from?
Theory OOP, classes & dunder methods
?
Candidate's answer

Understood functions are instances of a function class and object is the root ancestor, but got stuck on the chicken-and-egg paradox of how classes themselves exist as objects.

Key takeaway

CPython resolves the bootstrap cycle in C: classes themselves are runtime objects instantiated by the built-in metaclass 'type' (where type(type) is type and type subclasses object).

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

New mock interview for a Python developer position: a live dialogue with candidate Chingiz and my comments. If you're preparing for an interview, want to understand typical mistakes and "how the interviewer thinks" — this episode is for you.

Subscribe, like 👍 and write in the comments which topics to cover in the next interviews — this way you'll help the channel grow and get more useful analysis!

What the video covers
• How to choose between for and while
• Namespaces vs scope
• List comprehension: what happens to scope
• Closures explained simply (outer/inner)
• pass and alternatives
• What None really is and where it's appropriate to use it
• Feedback to candidate: why it's important to answer "why", not just "how"

For whom
• Juniors and middles preparing for Python interviews
• Anyone who wants to systematize theory

Timestamps

00:00 Greeting and interview plan
00:33 Introduction of participants
04:40 Theoretical questions
20:57 Working with code
53:47 Feedback exchange

Want more mock interviews and problem breakdowns? Support the video with a like and subscribe — this is the best motivation to make more helpful episodes.

Useful links:
• Preparation for Python interviews — https://habr.com/ru/companies/yandex_praktikum/articles/940622/

Hashtags

#python #interview #interview #junior #backend #loops #scope #closure #listcomprehension #None #pass #ITcareer #interviewpreparation