import asyncio
async def hello():
while True:
await asyncio.sleep(0.2)
print('hello')
async def world():
while True:
await asyncio.sleep(0.8)
print('world')
async def asynchronous():
tasks = [asyncio.ensure_future(hello()), asyncio.ensure_future(world())]
await asyncio.wait(tasks)
loop = asyncio.get_event_loop()
loop.run_until_complete(asynchronous())