Spaces:
Sleeping
Sleeping
File size: 454 Bytes
277f829 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import asyncio
async def countdown():
for i in range(5):
print(f"Countdown: {5-i}")
await asyncio.sleep(1)
async def do_some_work(name, delay):
print(f"{name} is starting work")
await asyncio.sleep(delay)
print(f"{name} is done with work")
async def do_a_lot_of_work():
await asyncio.gather(do_some_work("A", 1), do_some_work("B", 2), do_some_work("C", 3))
#asyncio.run(do_a_lot_of_work())
asyncio.run(countdown()) |