async/await in Python is built on top of the asyncio event loop. It lets you write concurrent code that looks synchronous.
```python import asyncio
async def fetch_data(url: str) -> str: await asyncio.sleep(1) # simulates I/O wait return f"data from {url}"
async def main(): # Run two fetches concurrently result1, result2 = await asyncio.gather( fetch_data("api.example.com/users"), fetch_data("api.example.com/posts"), ) print(result1, result2)
asyncio.run(main()) ```
**Key concepts:** - **async def** defines a coroutine - **await** pauses execution until the awaited coroutine completes, yielding control to the event loop - **asyncio.gather()** runs multiple coroutines concurrently