import asyncio
import time
async def say_after(delay, msg):
"""
:param delay: how many seconds to delay
:param msg: message to print to console
:return: None
"""
await asyncio.sleep(delay)
print(msg)
async def main():
print(f"started at {time.strftime('%X')}")
# execute async functions in order
await say_after(delay=3, msg='hello')
await say_after(delay=2, msg='world')
print(f"finished at {time.strftime('%X')}")
# run async main function
asyncio.run(main())
# output
# started at 16:47:08
# hello
# world
# finished at 16:47:13