Advertisement
Roman9234

Untitled

Apr 9th, 2024
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | Source Code | 0 0
  1. import asyncio
  2. import time
  3.  
  4.  
  5. async def Krash_go():
  6.     print("Крош начал движение")
  7.     await asyncio.sleep(3)
  8.     print('Крош прибыл к причалу')
  9.  
  10.  
  11. async def Chico_go():
  12.     print("Ежик начал движение")
  13.     await asyncio.sleep(3)
  14.     print('Ежик прибыл к причалу')
  15.  
  16.  
  17. async def main():
  18.     task1 = asyncio.create_task(Krash_go())
  19.     task2 = asyncio.create_task(Chico_go())
  20.  
  21.     await task1
  22.     await task2
  23.  
  24.  
  25. print(time.strftime('%X'))
  26.  
  27. asyncio.run(main())
  28.  
  29. print(time.strftime('%X'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement