Skip to main content

Practice · 2 of 2

Bounded Waits

CHALLENGE
Difficulty: intermediate+25 XP

Implement async def with_deadline(coro, seconds) awaiting asyncio.wait_for(coro, timeout=seconds) and returning ('ok', result) on success or ('timeout', None) on asyncio.TimeoutError. Provide sync wrapper run_deadline(coro, seconds).

Back to lesson: Practice: gather and Timeout Drills