Section 4. Chapitre 4
single
Challenge: Async Web Request Simulator
Glissez pour afficher le menu
Tâche
Glissez pour commencer à coder
Your task is to implement an asynchronous function to simulate web requests using the asyncio library.
- Complete the
simulate_web_requestcoroutine to:- Wait asynchronously for the given
delayseconds. - Print a message in the format:
"<name> completed after <delay> seconds"when finished.
- Wait asynchronously for the given
- Ensure all three web requests in
main()run concurrently, not sequentially. - Do not change the function signatures or the
main()logic. - The output should include all three completion messages, each with the correct request name and delay.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 4
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion