Question from the Python test

Waiting for validation

Consider the two asynchronous functions below:

import asyncio

async def second_function():
    for _ in range(5):
        print('Second function iteration')
        await asyncio.sleep(3)


async def first_function():
    for _ in range(5):
        print('First function iteration')
        await asyncio.sleep(5)


async def main():
    task1 = asyncio.create_task(first_function())
    task2 = asyncio.create_task(second_function())

    await task1
    await task2


asyncio.run(main())

What can you say about the order of execution of these two functions?

Author: John PendenqueStatus: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!