Home / Challenges / Run Multiple Async Tasks Concurrently

Run Multiple Async Tasks Concurrently

Medium
Write an async function fetch_all(delays) where delays is a list of numbers. For each delay, create a coroutine that awaits asyncio.sleep(delay) and then returns that delay value. Use asyncio.gather() to run all coroutines concurrently and return a list of results in the same order as the input.

Input

A list of numeric delays, e.g. [0.1, 0.2, 0.05].

Output

A list of the same numbers, returned after all coroutines complete.

Example

Input
[0.01, 0.02, 0.005]
Output
[0.01, 0.02, 0.005]
20 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.