concurrency with asyncio we have also modified the worker function slightly so that label is added to the random number generated so that it is clear which invocation of the worker function return which resultasync def worker(label)print('worker will take some time'await asyncio sleep( result random randint( , print('worker done it'return label str(resultwhen we run this program def main(print('main starting'asyncio run(do_something()print('main done'the output is main starting do_something will wait for worker worker will take some time worker will take some time worker will take some time worker done it worker done it worker done it do_something resultc do_something resulta do_something resultb main done as you can see from thisthe results are not returned in the order that the tasks are createdtask 'ccompletes first followed by 'aand 'bthis illustrates the behaviour of the asyncio as_completed(function online resources see the following online resources for information on futuresdocumentation on asyncio asyncio asyncio tutorial