I have a function
async def hello(a):
await asyncio.sleep(2)
print(a)
I want to call this function for several elements in a list asynchronously
list = ['words','I','need','to','print','parallely']
Something like this, but the below code runs one after the other.
for word in list:
await hello(word)
Is there a better way to do this? I had used asyncio.create_task
but not sure how to use them in loops.