I am trying to run the below program using asyncio:
import asyncio
async def main():
print('Hello')
await asyncio.sleep(1)
print('World')
asyncio.run(main())
However, I am getting the following error:
AttributeError: module 'asyncio' has no attribute 'run'
python --version gives: Python 2.7.8
python3 --version gives: Python 3.7.1
I am running the script as python3 script.py
Any ideas on how can I run this program without any error?