The async keyword is used to define an asynchronous function, while the await keyword is used to wait for the completion of an asynchronous operation. This allows for non-blocking I/O operations.
Solution Code
Programming Languages
import asyncio
async def main():
print("Hello")
await asyncio.sleep(1)
print("World")
asyncio.run(main())
Explanation
This code snippet demonstrates how to use async and await to run asynchronous code.Guided Hints
Use asyncio library
Define an async function
Use await to pause execution