

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Synchronous vs. Asynchronous
incomplete
2: Why Do We Want Async Code?
incomplete
3: Coroutines & the Event Loop
incomplete
4: Why Are Coroutines Useful?
incomplete
5: Using Coroutines
incomplete
6: Creating Coroutines
incomplete
This lesson's interactive features are locked, please to keep using them
We've used the await keyword a few times in this course. Now it's time to understand what's happening under the hood.
await pauses the current coroutine until the awaited coroutine (or other awaitable) finishes and returns a value. It lets Python switch to other work instead of blocking.
You can only use the await keyword:
async def function.Similar to before, the update_task_status function takes a task id, current status and completed state and returns a coroutine.
On line 5, call update_task_status with inputs:
Then await the returned coroutine and save the returned value in a variable called message which will be logged to the console (which is already written on line 9).