← Back to videos

Mock interview with Andrey for a Junior Python developer position

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Passed interview Level: Junior+ (theory approaching Middle)

The candidate passed confidently: demonstrated broad Python knowledge above a typical Junior bar, clear communication, and sound reasoning when challenged on edge cases and contradictions. The main gap for product engineering roles is hands-on production experience beyond textbook examples.

Candidate: Andrey
Target role: Junior Python Backend

28 y/o · Python instructor & curriculum author, learning FastAPI, no prior commercial product engineering experience

Answers accuracy 19 total
68% score
Theory
9/13 correct · 81%
Live coding
2/6 correct · 42%
Practical task
Partially solved

Special float values: inf, nan, and sorted() behavior

Core float() conversions, float('inf'), and value vs identity comparisons (== vs is) were explained accurately. IEEE 754 edge cases — inf - inf -> nan, nan == nan -> False, and broken ordering in sorted() with NaN — stumped the candidate, though his live reasoning remained structured.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Broad theoretical horizon above a typical Junior Python candidate
  • + Calm, structured communication and clear step-by-step reasoning under pressure
  • + Careful hypotheses on unfamiliar topics and mature handling of tricky follow-up questions
  • + Solid grasp of Python's memory model (references, mutability, == vs is)

Areas to improve

  • → Build hands-on experience beyond textbook scenarios (pet projects, internships, production code)
  • → Study Python data-model protocols deeper (e.g., context manager __enter__ / __exit__)
  • → Review IEEE 754 floating-point edge cases: inf arithmetic, NaN reflexivity, and Timsort behavior
  • → State knowledge boundaries directly instead of circling around unfamiliar details

Questions in this interview

19 / 19
01 ▶ 04:26
What is syntactic sugar in Python?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Language constructs that let you write code more concisely and readably while preserving semantics and performance.

Key takeaway

Syntactic sugar improves ergonomics and readability without adding new fundamental runtime capabilities.

Open moment on YouTube ↗
#01
02 ▶ 05:15
Give examples of syntactic sugar in Python: do x += 1, chained comparisons 0 < x < 10, and if x qualify?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Suggested x += 1, 0 < x < 10, and if x, then caught himself realizing += and truthiness checks alter runtime semantics.

Key takeaway

x += y invokes __iadd__ (mutating mutable objects in-place), and if x checks general truthiness rather than equality to True.

Open moment on YouTube ↗
#02
03 ▶ 09:00
What are list comprehensions and how do they differ under the hood from a for-loop with .append()?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Idiomatic one-line list construction without explicit .append() calls, with bytecode-level differences from a regular loop.

Key takeaway

CPython compiles list comprehensions using the dedicated LIST_APPEND opcode, avoiding repeated method lookups on each iteration.

Open moment on YouTube ↗
#03
04 ▶ 09:57
What is bytecode in Python and how is it used when running a program?
Theory Python internals, bytecode & runtime
?
Candidate's answer

An intermediate representation executed by the Python Virtual Machine (PVM), cached on disk and recompiled when source files change.

Key takeaway

Cached .pyc files speed up module startup/import time by skipping parsing and compilation, not the execution speed itself.

Open moment on YouTube ↗
#04
05 ▶ 10:50
Is Python compiled or interpreted, and why shouldn't the language itself be called an interpreter?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Contrasted Python with C++, initially conflating the language with its interpreter before separating language specification from runtime implementation.

Key takeaway

A language is a specification; compilation vs interpretation is a property of a specific runtime implementation.

Open moment on YouTube ↗
#05
06 ▶ 12:02
What implementations of Python exist besides standard CPython?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Named reference CPython (written in C), Jython (JVM), IronPython (.NET), and PyPy.

Key takeaway

Key alternatives include PyPy (with a tracing JIT compiler), MicroPython for embedded targets, and compilers like Cython/Nuitka.

Open moment on YouTube ↗
#06
07 ▶ 15:50
What does writing 'Pythonic' code mean?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Following idiomatic Python patterns: clean comprehensions, readability conventions, and underscore naming (_protected) instead of rigid access modifiers.

Key takeaway

Pythonic code leverages built-in protocols and idioms for clarity rather than translating patterns verbatim from Java or C++.

Open moment on YouTube ↗
#07
08 ▶ 18:43
Are PEP 8 and other PEPs strict language standards or community conventions?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Expanded PEP, cited Guido van Rossum on code being read far more often than written, and concluded PEP 8 is a convention enforced by teams rather than the interpreter.

Key takeaway

Syntax rules are enforced by the parser, whereas PEP 8 style guidelines are enforced by linters/formatters in CI.

Open moment on YouTube ↗
#08
09 ▶ 21:10
Is Python's ternary conditional expression syntactic sugar?
Theory Control flow, loops & syntactic sugar
?
Candidate's answer

Yes — a compact single-line conditional expression replacing a four-line if/else assignment block.

Key takeaway

x if cond else y evaluates lazily and produces a value directly as an expression.

Open moment on YouTube ↗
#09
10 ▶ 22:19
Are f-strings syntactic sugar over str.format()?
Theory Strings, encodings & formatting
?
Candidate's answer

Described expression interpolation and format specifiers accurately, but argued f-strings are an alternative tool rather than syntactic sugar.

Key takeaway

f-strings (PEP 498) are syntactic sugar for string interpolation that also compile into faster FORMAT_VALUE / BUILD_STRING opcodes.

Open moment on YouTube ↗
#10
11 ▶ 24:52
What is a context manager (with) and what problem does it solve?
Theory Decorators, iterators, generators & context managers
?
Candidate's answer

Automates resource setup and deterministic cleanup upon exiting the block, citing file streams (with open) and DB sessions in FastAPI.

Key takeaway

A with-block guarantees resource finalization (files, sockets, locks, DB transactions) even when exceptions occur inside the block.

Open moment on YouTube ↗
#11
12 ▶ 30:20
Can any function or object be used with the 'with' statement? What is the technical requirement?
Theory Decorators, iterators, generators & context managers
?
Candidate's answer

Guessed that a context can be used for almost any code though unnecessary, missing the required context manager protocol.

Key takeaway

Only objects implementing __enter__ and __exit__ (or @contextlib.contextmanager) work with 'with'; arbitrary functions raise TypeError.

Open moment on YouTube ↗
#12
13 ▶ 32:05
Does syntactic sugar (ternary expressions, @app.get decorators) contradict the Zen of Python's 'Explicit is better than implicit'?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Defended his view well: decorators explicitly declare intent at a higher abstraction level, whereas 'implicit' warns against hidden side effects or type tricks like True + True == 2.

Key takeaway

Good abstractions hide boilerplate while keeping intent explicit — balancing competing Zen aphorisms shows engineering maturity.

Open moment on YouTube ↗
#13
14 ▶ 38:42
What does built-in float() accept and what does float('inf') produce?
Live coding Data types, numbers & memory
?
Candidate's answer

Converts numbers and numeric strings to floats, raises ValueError on 'abc', and creates positive/negative infinity via float('inf') / float('-inf').

Key takeaway

Besides numeric strings and 'inf'/'-inf', float() also accepts case-insensitive 'Infinity' and 'nan' per IEEE 754.

Open moment on YouTube ↗
#14
15 ▶ 41:57
What do a == b and a is b evaluate to for a = float('inf'); b = float('inf'), and after b = a?
Live coding Data types, numbers & memory
?
Candidate's answer

Correctly predicted both: a == b is True (equal value), a is b is False (distinct float objects in memory), and after b = a both point to the same object so a is b is True.

Key takeaway

Unlike None/True/False singletons, separate float('inf') calls allocate distinct float objects in memory.

Open moment on YouTube ↗
#15
16 ▶ 44:17
What is the result of subtracting float('inf') - float('inf')?
Live coding Data types, numbers & memory
?
Candidate's answer

Predicted 0.0 assuming subtracting equal values yields zero; saw nan when the snippet ran.

Key takeaway

In IEEE 754 arithmetic, indeterminate forms (inf - inf, inf / inf, 0 * inf) evaluate to nan rather than 0.0 or raising an exception.

Open moment on YouTube ↗
#16
17 ▶ 46:56
What is nan and what type does type(float('inf') - float('inf')) return?
Live coding Data types, numbers & memory
?
Candidate's answer

Briefly confused nan with None by ear, corrected to Not a Number, and tentatively guessed float or a float subclass.

Key takeaway

nan is not a separate class — it is a special IEEE 754 bit pattern of the built-in float type itself.

Open moment on YouTube ↗
#17
18 ▶ 49:13
What does float('nan') == float('nan') return, and why?
Live coding Data types, numbers & memory
?
Candidate's answer

Predicted True and could not explain why NaN compares unequal to itself after seeing False.

Key takeaway

Per IEEE 754, NaN != NaN is always True (and NaN == NaN is False); use math.isnan(x) to test for NaN.

Open moment on YouTube ↗
#18
19 ▶ 51:44
What does sorted([1.0, float('nan'), 2.0, float('nan'), 0.0]) return, and why does sorting break?
Live coding Data types, numbers & memory
?
Candidate's answer

Expected 0.0, 1.0, 2.0 to be sorted in ascending order with nan at the front; was stumped when 0.0 stayed at the end.

Key takeaway

All < and > comparisons with NaN return False, breaking total ordering in Timsort; handle NaNs explicitly via filtering or key=lambda x: (math.isnan(x), x).

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

Mock interview for a Junior Python Backend position in question-and-answer format: simple questions, tricky tricks and depth of understanding check.

In the interview we discuss:
• what syntactic sugar is in Python and where the boundary lies (list comprehensions, ternary operator, f-strings, with)
• bytecode, interpreter and different Python implementations (CPython and others)
• "pythonic" style and PEP8: standard or agreement
• coding practice and unexpected edge cases

At the end — honest feedback to the candidate: strengths, gaps and what to improve for hiring.

Timestamps

00:00 Greeting and interview plan
00:31 Introduction of participants
04:25 Theoretical questions
38:24 Working with code
56:20 Feedback exchange