19 lines
386 B
Python
19 lines
386 B
Python
import asyncio
|
|
|
|
max_counts = {"Counter 1": 13, "Counter 2": 7}
|
|
|
|
|
|
async def counter(name: str, max_count: int):
|
|
for i in range(1, max_count + 1):
|
|
print(f"{name}: {i}")
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
async def main():
|
|
tasks = []
|
|
for name, value in max_counts.items():
|
|
tasks.append(counter(name, value))
|
|
await asyncio.gather(*tasks)
|
|
|
|
|
|
asyncio.run(main())
|