Junior — Senior
Parallel task execution with different delays
livecode
Task condition
Situation: one coroutine is delayed, while another outputs the result immediately. It is required to indicate the order in which the messages will appear when launched simultaneously:
import asyncio
async def delayed_task():
await asyncio.sleep(10)
print("foo")
async def instant_task():
print("bar")
async def run_all():
await asyncio.gather(delayed_task(), instant_task())
asyncio.run(run_all())