?
How is a coroutine defined in Python using the async keyword?
Answer & Solution
Correct Answer:
Option
C
The correct answer is Option C: async def.
In Python, a coroutine is defined using the async def syntax. This keyword combination indicates to the interpreter that the function is a coroutine, allowing it to use asynchronous features such as await expressions and yield statements within the function body. The async def syntax is specifically designed for defining coroutines, providing a clear and concise way to declare asynchronous functions in Python.
In Python, a coroutine is defined using the async def syntax. This keyword combination indicates to the interpreter that the function is a coroutine, allowing it to use asynchronous features such as await expressions and yield statements within the function body. The async def syntax is specifically designed for defining coroutines, providing a clear and concise way to declare asynchronous functions in Python.
Join the Discussion
Login to post a comment or share your explanation.
Login