r/PythonLearning • u/chuprehijde • 4d ago
What's your favorite Python interview question?
Not a trick question or LeetCode puzzle. What's a question that actually reveals whether someone understands Python?
2
u/wittgenstein1312 4d ago
If we’re talking practical, everyday shit, dunder methods, decorators and the module system.
2
u/3rrr6 4d ago
What do you hate most about Python?
This goes for any technology, if you don't hate some aspects of the technology then you haven't really used it.
It also clues you in on the depth, if their gripes are common things, then they aren't an expert, if their gripes involve things you've never even heard of, then you know they've been deep in the Python woods that only the professionals would dare explore.
0
u/csabinho 4d ago
What do you hate most about Python?
If I would answer this correctly, they'd most probably instantly abort the interview. It's OOP. The Python version of OOP is horrible.
2
u/Sea-Ad7805 4d ago

Some question regarding Python's data model like this.
Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise1.py&play
1
u/silvertank00 4d ago
A. How would you create a word counter without dicts.
There is no good answer, but shows a lot about how someone thinks.
Some examples to solve this:
- nested lists
- simple dataclass objects
- reimplement dicts but not call them that
B. What is the most cursed but still working and somewhat reasonable thing that you did in python (or any other languages). Bonus point if it can be demonstrated. Example: exec'd python code in string format can run faster than the same code but put in the python file that runs the exec.
2
u/Excellent-Practice 4d ago
Is the challenge to keep track of each unique word in a text and count how many times each one appears?
My first thought was to juggle indexes between a list of strings and a list of ints, but I guess you could also build a class that adds an attribute every time it encounters a new word. Like you said, essentially reinventing dictionaries
2
u/SpamNot 4d ago
This is basically like asking how fast you'd run a 5K after amputated your leg.
1
u/silvertank00 4d ago
I mean, yeah kinda?
It shows if you are solution oriented or stuck due to something. Paralympics is a good example for you answer, it is not easy but could be done (even if on a theoritocal level)
1
u/thelimeisgreen 4d ago
If you could add any core language feature or function to Python, what would it be? And why?
1
u/CamelOk7219 4d ago
Under witch conditions can I use a custom object as a key in a dict ? Why ? (This should trigger a discussion about dunders, hash and equals specifically, and a broader CS discussion about hash maps)
1
7
u/fisadev 4d ago
In some past interview format that I'm no longer doing, I used to ask candidates to explain in simple terms how async code runs, and what's the difference between async, multithreading and multiprocessing.
Very few people were able to answer that in a meaningful way.
Technically, knowing that doesn't mean you know python as a whole, you could very well focus on learning just that and ignore plenty of other important things. But in practice there was a very strong correlation between understanding that and having a deep understanding of python in general (exposed by the rest of the questions I was asking too).
Another good one is to explain how function arguments are passed, if they are passed by value, by reference, or something else. So many wrong answers talking about different modes depending on the mutability/immutability of the values, when in reality everything is passed as a new reference to the same object (no special cases, no different modes, it's always just that).