initial commit
This commit is contained in:
27
Python/telegram/task1.py
Normal file
27
Python/telegram/task1.py
Normal file
@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
from typing import Never
|
||||
|
||||
|
||||
async def print_nums() -> Never:
|
||||
num = 1
|
||||
while True:
|
||||
num += 1
|
||||
print(num)
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
|
||||
async def print_time() -> Never:
|
||||
count = 0
|
||||
while True:
|
||||
if not count % 3:
|
||||
print(f"Time {count}")
|
||||
count += 1
|
||||
await asyncio.sleep(1)
|
||||
|
||||
|
||||
async def main() -> Never:
|
||||
await asyncio.gather(print_nums(), print_time())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
Reference in New Issue
Block a user