So far, you have learned about Python's coroutines and a bit about how a cooperative coroutine scheduler works. Now, let's try our hand at writing some asynchronous code using Python coroutines and asyncio. We start this by creating a coroutine.
Using the asyncio event loop and coroutine scheduler
Creating a coroutine
It's easy to create a coroutine—all we have to do is use the async keyword on a function and use await anytime we want to call other coroutines, as shown in following code example:
![](https://static.packt-cdn.com/products/9781787283695/graphics/assets/769b4bbf-c77b-4daa-a570-211ef1c350bc.jpg)
Once we have a coroutine though, we can't just call it to get the ball rolling. If we try to call it, it immediately returns a coroutine object, as shown in the following code example—that's...