← Quiz: LLM Workflow Patterns: all 10 questions
Quiz: LLM Workflow Patterns · Question 6 of 10
What does this print? (code)
What does this print?
from concurrent.futures import ThreadPoolExecutor
import time
def work(n):
time.sleep(0.05 * (3 - n))
return n * 10
with ThreadPoolExecutor(max_workers=3) as pool:
print(list(pool.map(work, [0, 1, 2])))
- A.[20, 10, 0]
- B.[0, 10, 20]
- C.[0, 1, 2]
- D.The order is random
Answer & explanation
Correct answer: [0, 10, 20]
pool.map returns results in input order, even though the calls finish in a different order.
Can you get the rest right without peeking?
Take the timed Quiz: LLM Workflow Patterns quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →