Examveda

How is a coroutine defined in Python using the async keyword?

A. coroutine def

B. def coroutine

C. async def

D. def async

Answer: Option C

Solution (By Examveda Team)

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.

This Question Belongs to Python Program >> Generators And Iterators

Join The Discussion

Related Questions on Generators and Iterators