Avsnitt 4. Kapitel 4
single
Challenge: Async Web Request Simulator
Svep för att visa menyn
Uppgift
Svep för att börja koda
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 4
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal