Seksjon 4. Kapittel 4
single
Challenge: Async Web Request Simulator
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 4
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår