Python Interview Questions — All Categories
9 questions tagged with Python as a technology, across every category it appears in
A Python CLI tool used in CI pipelines always exits with code 0, even when it detects and reports a real failure. What breaks because of this, and how do you fix it?
IntermediatePython6 min
An automation script opens a database connection, does some work, and closes it at the end — but an exception partway through leaves the connection open. Why does 'with' fix this, and how does it actually work?
IntermediatePython6 min
You want to speed up a Python automation script that processes many files. Should you use threading or multiprocessing? What does the GIL actually have to do with this decision?
IntermediatePython7 min
A script calling a flaky API retries immediately with a fixed 1-second delay. During a real outage, this made things worse. Why, and how should retry logic actually be designed?
IntermediatePython7 min
A log-processing script uses json.load() to parse a multi-gigabyte newline-delimited JSON log file and gets killed with an out-of-memory error. What's wrong, and how do you fix it?
IntermediatePython7 min
A Python automation script uses subprocess.run(f'kubectl get pod {pod_name}', shell=True) where pod_name comes from user input. What's actually wrong with this, and how do you fix it?
AdvancedPython7 min
How would you handle a data transformation that genuinely needs to see the whole dataset at once, like a global sort, when streaming isn't an option?
AdvancedPython8 min
A Python script that processes a large file works fine on your laptop but gets OOM-killed when run in a container with a memory limit. What's likely wrong, and how do you fix it?
IntermediatePythonDocker8 min
How would ruamel.yaml configured for YAML 1.2 handle the same enabled: no example differently from PyYAML's default loader?
IntermediateYAMLPython6 min