Question library
Questions from real interviews. Drill any of them by voice in a couple of minutes, with an interviewer, a score and feedback.
What are generators in Python, and how are they different from regular functions? In which cases would you use them?JuniorYou need to process a 20 GB log file: filter the lines and compute some aggregates over them. How would you write that in Python?Mid-levelHow is a generator different from a regular iterator, and what actually happens on yield? Tell me about send and yield from — where have you used them?SeniorThere's a log file of tens of gigabytes; each line contains, separated by spaces, the timestamp, method, path, status, and response time in milliseconds. Write a function top_error_paths that takes the file path and a number k and returns the k paths with the most 5xx responses, along with how many malformed lines were skipped.Senior