text: # import asyncio
  # import random
  
  
  # async def produce(queue, n):
  #     for x in range(1, n + 1):
  #         # produce an item
  #         print('producing {}/{}'.format(x, n))
  #         # simulate i/o operation using sleep
  #         await asyncio.sleep(random.random())
  #         item = str(x)
  #         # put the item in the queue
  #         await queue.put(item)
  #         print(queue.qsize())
  
  #     # indicate the producer is done
  #     await queue.put(None)
  
  
  # async def consume(queue):
  #     while True:
  #         # wait for an item from the producer
  #         item = await queue.get()
  #         if item is None:
  #             # the producer emits None to indicate that it is done
  #             break
  
  #         # process the item
  #         print('consuming item {}...'.format(item))
  #         # simulate i/o operation using sleep
  #         await asyncio.sleep(random.random())
  
  
  # loop = asyncio.get_event_loop()
  # queue = asyncio.Queue(loop=loop)
  # producer_coro = produce(queue, 10)
  # consumer_coro = consume(queue)
  # loop.run_until_complete(asyncio.gather(producer_coro, consumer_coro))
  # loop.close()
  
  import asyncio
  
  loop = asyncio.get_event_loop()
  q = asyncio.Queue(loop=loop)
   
  async def worker(q):
      print("Starting work")
      await asyncio.sleep(5)
      q.put_nowait(10)
      print("Work complete")
   
  async def other_worker(q):
      print("Starting other worker")
      await asyncio.sleep(2)
      n = await q.get()
      print('num:',n)
      print("Other worker complete")
   
  async def third_worker():
      print("Starting third worker")
      await asyncio.sleep(1)
      print("Third worker complete")
   
  async def main():
      print("Starting workers")
      tasks = []
      tasks.append(asyncio.ensure_future(worker(q)))
      tasks.append(asyncio.ensure_future(other_worker(q)))
      
   
      print("First two workers added to the event loop.")
      for task in tasks:
          await task
   
      print("Adding third worker to the event loop.")
      await third_worker()
      # in this case, this is the same thing
      await asyncio.ensure_future(third_worker())
  
  loop.run_until_complete(main())
  loop.close()