16 lines
280 B
Python
16 lines
280 B
Python
import asyncio
|
|
|
|
|
|
async def print_with_delay(delay: int):
|
|
await asyncio.sleep(1)
|
|
print(f"Coroutine {delay} is done")
|
|
|
|
|
|
async def main():
|
|
tasks = []
|
|
for i in range(10):
|
|
tasks.append(print_with_delay(i))
|
|
await asyncio.gather(*tasks)
|
|
|
|
|
|
asyncio.run(main())
|