Your question is Parallel Fetching With Three Paradigms. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Task #2: Implement a data fetching service that runs three parallel asynchronous fetches and collects results using three distinct concurrency paradigms: callback-based (DispatchGroup), Combine publisher-based (MergeMany/collect), and Structured Concurrency (withTaskGroup).
Asked in the First Technical Assessment (Timed Debugging Test) stage. This was a 90-minute timed assignment, and Stack Overflow or forum searches were prohibited.
Implement the Python function below so it models the same behavior for three fetches: run them in parallel, collect successful results, and return "error" immediately if any fetch fails.
def fetch_three_results(fetches):
fetches: a list of exactly 3 values, each either a string result or the string "error".
Return a list of the three successful results in completion order, or the string "error" if any fetch fails.
def fetch_three_results(fetches):