Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import asyncio
  2.  
  3. async def update():
  4.     while True:
  5.         await asyncio.sleep(0.1)
  6.         print("update")
  7.  
  8. async def play_game():
  9.     for _ in range(100):
  10.         print("game")
  11.         await asyncio.sleep(1)
  12.  
  13.  
  14. def main():
  15.     loop = asyncio.get_event_loop()
  16.     loop.create_task(update())
  17.     loop.run_until_complete(play_game())
  18.  
  19.  
  20. if __name__ == '__main__':
  21.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement