🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 17: Search Results Page

Python Challenge
Step 1 of 3
Project

Concurrent Futures for Parallel Searches

Use ThreadPoolExecutor.map() to query several search sources at once instead of one after another. concurrent.futures gives threading a simpler, higher-level interface — you get a pool that manages the threads for you, and just hand it the function and the inputs.

🎯 Your Task

Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!

from concurrent.futures import ThreadPoolExecutor

def search_source(source):
    return f"{source}: 3 results"

sources = ["docs", "blog", "forum"]

with ThreadPoolExecutor(max_workers=3) as executor:
    results = list(executor.map(search_source, sources))

print(results)