concurrency with asyncio the main(function is the entry point for the program and callsasyncio run(do_something()this starts the async io event loop running and results in the do_something(function being wrapped up in task that is managed by the loop note that you do not explicitly create task in async iothey are always created by some function however it is useful to be aware of tasks as you can interact with them to check their status or to retrieve result the do_something(function is marked with the keyword asyncasync def do_something()print('do_something will wait for worker'result await worker(print('do_something result:'resultas previously mentioned this indicates that it can be run as separate task and that it can use the keyword await to wait for some other function or behaviour to complete in this case the do_something(asynchronous function must wait for the worker(function to complete the await keyword does more than merely indicate that the do_something (function must wait for the worker to complete it triggers another task to be created that will execute the worker(function and releases the processor allowing the event loop to select the next task to execute (which may or may not be the task running the worker(functionthe status of the do_something task is now waiting while the status of the worker(task is ready (to runthe code for the worker task is given belowasync def worker()print('worker will take some time'time sleep( print('worker done it'return the async keyword again indicates that this function can be run as separate task howeverthis time the body of the function does not use the await keyword this is because this is special case known as an async io coroutine function this is function that returns value from task (it is related to the idea of standard python coroutine which is data consumersadlycomputer science has many examples where the same term has been used for different things as well as examples where different terms have been used for the same thing in this case to avoid confusion just stick with async io coroutines are functions marked with async that can be run as separate task and may call await