Lis le code attentivement
import asyncio
async def fetch(name, delay):
print(f"start {name}")
await asyncio.sleep(delay)
print(f"done {name}")
return name
async def main():
results = await asyncio.gather(
fetch("A", 1), # sleeps 1 s
fetch("B", 2), # sleeps 2 s
)
print(results)
asyncio.run(main())
# What does this print? Type your prediction.
# Hint: both fetches enter immediately (gather schedules them
# together). A finishes first (shorter sleep). The list at the end
# matches the ORDER the tasks were passed to gather, NOT the
# completion order.Que va afficher le programme ? Écris ici :