← Back to videos

Mock interview with Daniyar for a Junior Python developer position

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Needs more practice Level: Beginner / Pre-Junior (broad topic awareness, very shallow foundational depth)

The candidate did not pass yet: over a year of study he built decent high-level familiarity and communicated fluidly without freezing up, but his knowledge proved very superficial — frequently contradicting his own prior answers, confusing list.sort() with sorted(), and failing to predict or explain lexicographical sorting of version strings.

Candidate: Daniyar
Target role: Junior Python Developer

21 y/o · studying Python and software development for ~1 year (Stepik courses, personal pet projects with Git)

Answers accuracy 14 total
43% score
Theory
0/7 correct · 36%
Live coding
2/7 correct · 50%
Practical task
Not solved

Lexicographical string comparison ('ёлка' < 'ель') and sorting version strings with sorted(versions)

After briefly mentioning character codes and the word 'lexicographically', the candidate pivoted to the false rule that Python compares strings strictly by length. Consequently, he could neither predict nor explain sorted(['1.10', '1.2', '1.9', '2.0', '10.1', '9.5']), only recognized character-code precedence after a guided counterexample ('ёлка' < 'елкам'), and couldn't explain how to compare strings by length via a str subclass or key=len.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Broad high-level familiarity after one year of study across algorithms, character encodings, built-in sorting, and dunder methods
  • + Responsive spoken communication without freezing up or long silences during probing follow-ups
  • + Self-aware, constructive reception of feedback and readiness to revisit core Python fundamentals

Areas to improve

  • → Move from skimming topics superficially to mastering core mechanics (list.sort() vs sorted(), Timsort, and key= functions)
  • → Maintain logical consistency across follow-up questions instead of flipping positions without explaining why
  • → Understand character-by-character lexicographical string comparison via Unicode code points and rich comparison dunder methods (__lt__, __gt__, __eq__)
  • → Rely strictly on genuine personal understanding in interviews rather than external prompts or unexplainable guesses

Questions in this interview

14 / 14
01 ▶ 03:08
What is an algorithm in plain terms, and can a programming problem be solved without one?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Defined an algorithm as a step-by-step plan from A to B, then contradicted himself by saying you can solve a problem without an algorithm by 'inventing steps on the fly' before conceding those steps are an algorithm.

Key takeaway

Any finite sequence of well-defined steps transforming input into output is an algorithm, whether it is a named classic algorithm or ad-hoc logic.

Open moment on YouTube ↗
#01
02 ▶ 04:35
How do different algorithms for the same task differ, and why do 'slow' algorithms exist when faster ones are available?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Pointed to execution speed (mentioning O(log n)) and, after follow-up prompting, noted that slower algorithms are often simpler to write and maintain when input sizes are small.

Key takeaway

Algorithms trade off time complexity, memory footprint, constant overhead, and implementation simplicity; simpler algorithms often win on small inputs or non-hot paths.

Open moment on YouTube ↗
#02
03 ▶ 07:34
Give an example of a sorting algorithm, and can arbitrary objects in Python always be sorted?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Named bubble sort and gave a practical example of sorting customer records by purchase total or last name, but mistakenly claimed any data types can always be sorted.

Key takeaway

Sorting requires elements (or their key= projections) to be mutually comparable via < (__lt__); sorting incompatible types like [1, 'a'] or [None, 1] in Python 3 raises TypeError.

Open moment on YouTube ↗
#03
04 ▶ 10:16
Between sort and sorted in Python, which is a function and which is a method, and how do they differ?
Theory Collections, lists, dicts & hash tables
?
Candidate's answer

Called both functions, claimed sorted() on a tuple or string returns 'a list containing a tuple', and said sort returns the same input type.

Key takeaway

sorted(iterable) is a built-in function that accepts any iterable and returns a new sorted list, while list.sort() is a list-only method that mutates the list in place and returns None.

Open moment on YouTube ↗
#04
05 ▶ 14:32
When should you use Python's built-in sort versus implementing a custom sorting algorithm?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Rightly recommended built-in sorting for everyday tasks, but mistakenly suggested writing a custom sort in Python to get higher speed on large datasets.

Key takeaway

CPython's C-implemented sort beats pure-Python custom sorts by orders of magnitude; custom ordering uses key=, while specialized algorithms only matter for out-of-core external sorting or C/NumPy numeric kernels.

Open moment on YouTube ↗
#05
06 ▶ 16:18
What algorithm powers Python's built-in sort()/sorted(), and are lambda functions actually faster C functions?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Admitted not knowing the exact algorithm inside sort()/sorted() (guessing C code), while falsely claiming lambda functions are prewritten in C and execute faster.

Key takeaway

Python's built-in sort uses Timsort (O(n log n) worst-case, O(n) best-case stable hybrid sort in C), while lambda compiles to the exact same Python function bytecode as def with zero speed advantage.

Open moment on YouTube ↗
#06
07 ▶ 17:22
How do you compare two algorithms' efficiency, and why can't slow code always be fixed by buying bigger servers?
Theory Algorithms, code reading & engineering practices
?
Candidate's answer

Mentioned mathematical analysis from CS courses and noted hardware upgrades don't scale indefinitely, while admitting he had never measured complexity or runtime himself.

Key takeaway

Engineers combine asymptotic Big-O analysis (time and space growth) with empirical profiling (timeit, cProfile), since poor algorithmic scaling quickly overwhelms hardware upgrades.

Open moment on YouTube ↗
#07
08 ▶ 22:11
What do 'abc' < 'abcd' and 'abcd' < 'abc' return, and how does Python compare strings?
Live coding Strings, encodings & formatting
?
Candidate's answer

Briefly mentioned ASCII/ord/chr and 'lexicographically' and predicted True and False, but immediately abandoned character comparison to claim strings are compared purely by length.

Key takeaway

Python compares strings lexicographically character by character using Unicode code points (ord()); length only decides the outcome when one string is a prefix of the other.

Open moment on YouTube ↗
#08
09 ▶ 25:20
What does 'ёлка' < 'ель' evaluate to and why?
Live coding Strings, encodings & formatting
?
Candidate's answer

Predicted the right boolean False, but justified it with his faulty string-length rule (4 > 3) rather than comparing the leading characters 'ё' and 'е'.

Key takeaway

'ёлка' < 'ель' is decided at index 0: in Unicode, Cyrillic 'ё' (U+0451, 1105) sits outside the main 'а'–'я' block and is greater than 'е' (U+0435, 1077).

Open moment on YouTube ↗
#09
10 ▶ 26:21
What does sorted(['1.10', '1.2', '1.9', '2.0', '10.1', '9.5']) return, and how does '.' affect string sorting?
Live coding Strings, encodings & formatting
?
Candidate's answer

Wavered between his length rule and an unexplained hunch that '10.1' swaps with '9.5', and after seeing ['1.10', '1.2', '1.9', '10.1', '2.0', '9.5'] couldn't explain why '10.1' preceded '2.0'.

Key takeaway

String sorting compares characters left to right: all '1...' strings precede '2.0' (with ord('.') == 46 < ord('0') == 48 keeping '1.x' before '10.1'); semantic version sorting needs key=lambda s: tuple(map(int, s.split('.'))).

Open moment on YouTube ↗
#10
11 ▶ 41:13
Why does 'ёлка' < 'елкам' still return False even though 'ёлка' is shorter, and when does length actually matter?
Live coding Strings, encodings & formatting
?
Candidate's answer

Initially suspected a Latin lookalike character, then with hints on alphabet codes deduced the right rule: character codes are compared first, and length breaks ties only when leading characters match.

Key takeaway

Lexicographical comparison stops at the first differing character index; string lengths are compared if and only if all characters of the shorter prefix match.

Open moment on YouTube ↗
#11
12 ▶ 44:09
How does the same comparison operator (<, >) work polymorphically across ints, strings, and custom objects?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Correctly explained that comparison operators dispatch to type-specific dunder methods (such as __eq__ and __gt__), which custom classes can override.

Key takeaway

Rich comparison operators (<, <=, ==, !=, >, >=) delegate to __lt__, __le__, __eq__, __ne__, __gt__, and __ge__ on the operand types.

Open moment on YouTube ↗
#12
13 ▶ 46:25
When in practice should a developer override rich comparison dunder methods?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Explained that overriding is needed whenever custom domain ordering is desired instead of default behavior, such as comparing objects by length or a specific field.

Key takeaway

Implementing __eq__ and __lt__ (often paired with @functools.total_ordering or @dataclass(order=True)) gives domain objects natural ordering across <, min(), max(), and sorted().

Open moment on YouTube ↗
#13
14 ▶ 47:26
How could you customize comparison so string objects compare via '<' strictly by length?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Concluded it is impossible to change '<' for strings since dunder overrides only apply inside a custom class.

Key takeaway

While built-in str is immutable in C, you can subclass it (class LenStr(str): def __lt__(self, other): return len(self) < len(other)) or simply pass key=len to sorted()/min()/max().

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

Mock interview for a Junior Python developer position: we analyze basic topics that often come up in interviews.

In this episode:
• what an algorithm is and whether you can solve a problem without an algorithm
• why there are "fast" and "slow" algorithms
• sorting: sort() and sorted(), the difference and what to choose
• comparing strings in Python: length vs encoding, where people usually get confused
• analyzing code on screen and discussing the logic of string number sorting
• detailed feedback to the candidate: strengths, gaps.

Timestamps

00:00 Greeting and interview plan
00:32 Introduction of participants
03:10 Theoretical questions
21:44 Working with code
48:46 Feedback exchange

Useful to look at/repeat after the episode
• lexicographic string comparison in Python
• difference between sorted() and .sort()
• key= in sorting, reverse=, custom sorting
• how Python compares objects and the role of magic methods (__lt__, __gt__, __eq__)

If it was helpful — support the video by subscribing and liking 👍

#python #interview #juniorpython #algorithms #sorting #programming #pythondeveloper