← Back to videos

Junior Python Mock Interview: Modules, Packages and Tricky Code

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Needs more practice Level: Beginner (~4 months of study, pre-Junior)

Too early for a Junior role: knowledge matches ~4.5 months of study. While the candidate stayed polite and reasoned from common sense, he struggled across core fundamentals (dynamic typing trade-offs, modules vs packages vs frameworks, if __name__ == '__main__', string literals), changed his mind easily under pushback, and tried to guess through unfamiliar topics instead of stating boundaries.

Candidate: Viktor
Target role: Junior Python Developer

23 y/o, Minsk · civil engineer switching careers, studying Python for ~4.5 months

Answers accuracy 12 total
54% score
Theory
3/6 correct · 58%
Live coding
2/6 correct · 50%
Practical task
Partially solved

Code review of interview.py: __name__ == '__main__', string literals, and function design

The candidate traced calc_area() accurately, caught the implicit None return on negative radius, and spotted redundant PI = 3.14 and unused import sys. However, he got tangled explaining if __name__ == '__main__':, wrongly predicted a SyntaxError on valid multi-part string literals, and missed design smells like side-effect printing inside a calculation function.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Courage to test himself early (~4.5 months in) and calm, pleasant communication despite nervousness
  • + Sound high-level understanding of why type hints and PEP 8 conventions matter for team readability
  • + Correctly traced implicit None return when a function branch lacks a return statement
  • + Relied on his own logical reasoning rather than appeals to authority

Areas to improve

  • → Run hands-on experiments in Python (imports, __name__, string literal continuations) so pushback cannot easily flip correct answers
  • → State 'I don't know' concisely instead of guessing at length through unfamiliar territory
  • → Learn the exact distinctions between module, package, library, and framework (inversion of control)
  • → Sharpen code-review instincts for dead code, side effects (printing errors inside pure math functions), and unused parameters

Questions in this interview

12 / 12
01 ▶ 04:14
Where did the name Python come from, and is it named after the snake?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Preferred the English pronunciation 'Python' over 'Piton', but admitted he did not know the origin of the language's name.

Key takeaway

Guido van Rossum named Python after the British sketch comedy series Monty Python's Flying Circus, not the reptile.

Open moment on YouTube ↗
#01
02 ▶ 05:36
What does dynamic typing mean in Python?
Theory Data types, numbers & memory
?
Candidate's answer

Explained that variable names are created without type declarations and the type belongs to the assigned runtime value itself.

Key takeaway

In Python, types attach to runtime objects rather than variable names; a variable is simply an untyped reference that can be rebound to any object.

Open moment on YouTube ↗
#02
03 ▶ 06:35
What are the real pros and cons of dynamic typing compared to static typing?
Theory Data types, numbers & memory
?
Candidate's answer

Argued that rebinding one variable to a different type saves memory and speeds up execution compared to declaring a second variable, missing real dynamic typing benefits.

Key takeaway

Dynamic typing enables rapid prototyping, concise code, and duck typing, while trading off compile-time type safety and raw execution speed.

Open moment on YouTube ↗
#03
04 ▶ 14:25
Why use type annotations in Python if the interpreter doesn't enforce them at runtime?
Theory Data types, numbers & memory
?
Candidate's answer

Correctly explained that the code still runs, while IDEs and static tools flag mismatches — aiding team collaboration, readability, and refactoring.

Key takeaway

Type hints power static type checkers (mypy, pyright), IDE autocompletion, maintainability, and runtime schema libraries like Pydantic and FastAPI.

Open moment on YouTube ↗
#04
05 ▶ 20:55
What are Python's main strengths given that CPython is slower than compiled languages?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Highlighted clean, readable syntax and a vast ecosystem of standard and third-party libraries and frameworks across domains.

Key takeaway

Python optimizes developer velocity and readability backed by a rich ecosystem, often delegating heavy computation to C/Rust extensions.

Open moment on YouTube ↗
#05
06 ▶ 22:12
What is the difference between a module, a package, a library, and a framework in Python?
Theory Modules, packages, imports & stdlib
?
Candidate's answer

Defined a module as a .py file and a package as a collection of modules, but conflated libraries with single documented modules and missed what distinguishes a framework.

Key takeaway

A module is a .py file; a package is a directory namespace of modules; your code calls a library, whereas a framework dictates architecture and calls your code (Inversion of Control).

Open moment on YouTube ↗
#06
07 ▶ 27:37
What does if __name__ == '__main__': check in interview.py, and why is it needed when importing modules?
Live coding Modules, packages, imports & stdlib
?
Candidate's answer

Knew __name__ equals '__main__' when run directly vs the module name elsewhere, but got tangled trying to explain import direction and why top-level calls execute on import.

Key takeaway

Importing a module executes all its top-level statements with __name__ set to the module's name; guarding entrypoint calls with if __name__ == '__main__': prevents side effects on import.

Open moment on YouTube ↗
#07
08 ▶ 39:52
What does calc_area(radius) return and what does main() print when radius < 0 triggers print('Error') without a return statement?
Live coding Functions, scopes & closures
?
Candidate's answer

Briefly said the program stops, then quickly corrected himself: a function branch with no explicit return yields None, so main() continues and prints 'Area = None'.

Key takeaway

Any Python function execution path that finishes without hitting an explicit return value implicitly returns None.

Open moment on YouTube ↗
#08
09 ▶ 43:56
Will variable assignments using parenthesized multi-line strings, backslash line continuations, and adjacent string literals raise a SyntaxError?
Live coding Strings, encodings & formatting
?
Candidate's answer

Started by guessing the code works, then flipped under questioning to predict a SyntaxError, thinking adjacent strings inside parentheses needed a comma.

Key takeaway

Adjacent string literals inside parentheses implicitly concatenate into a single str at parse time ( whereas adding a comma turns them into a tuple!).

Open moment on YouTube ↗
#09
10 ▶ 50:06
Which redundant imports and global variables should be cleaned up in this script?
Live coding Modules, packages, imports & stdlib
?
Candidate's answer

Spotted the unused import sys, unused quote* variables, and the redundant global PI = 3.14 alongside from math import pi.

Key takeaway

Unused imports, dead variables, and shadowed/manual approximations like PI = 3.14 alongside math.pi clutter module namespaces and hurt maintainability.

Open moment on YouTube ↗
#10
11 ▶ 55:25
What is a function side effect, and what design flaws remain in calc_area() and main()?
Live coding Functions, scopes & closures
?
Candidate's answer

Did not know the term side effect and missed both the unused default parameter main(x=1) and printing 'Error' inside calc_area() instead of raising ValueError.

Key takeaway

Calculation helpers should stay pure and raise ValueError on invalid inputs rather than printing to stdout and silently returning None.

Open moment on YouTube ↗
#11
12 ▶ 55:45
Is PEP 8 a strict rulebook or a style guideline, and what formatting violations appear in the snippet?
Live coding Algorithms, code reading & engineering practices
?
Candidate's answer

Clarified that PEP 8 is a style convention for team readability and caught missing spaces around < and extra whitespace inside calc_area( radius ), while missing several other PEP 8 issues.

Key takeaway

PEP 8 specifies whitespace around binary operators, no spaces immediately inside parentheses, and two blank lines around top-level function definitions.

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

A mock interview for a Junior Python Developer role with a candidate who has been learning Python for around four months. We discussed dynamic typing, type annotations, modules, packages, libraries, frameworks, and the `if __name__ == "__main__"` construct.

In the second part — a breakdown of the tricky code: what works here, what raises questions, and which errors weren’t spotted straight away. At the end — detailed feedback: what the candidate got right, where the main gaps were, and what to focus on next.

Timecodes:

00:00 Start
00:30 Introduction
02:01 How the interview will proceed
04:10 Python or Python
05:36 What is dynamic typing
14:25 Type annotations in Python
16:56 Is dynamic typing useful?
21:06 The advantages of Python and a discussion of frameworks
22:12 What are frameworks, modules, packages and libraries?
26:30 Moving on to code review
27:37 What does `if __name__ == "__main__"` do?
39:52 Analysis of the main code
44:08 Is this code working?
50:06 What can be improved in the code
55:27 PEP 8 and coding style
57:53 Moving on to feedback
59:19 Feedback from the interviewer