LearnPy Hub
← Async Basics problems
Hard

Two Workers Share a Queue

Put the input numbers into an asyncio.Queue. Start two worker tasks that take numbers until the queue is empty (use get_nowait and stop on QueueEmpty), awaiting a tiny sleep for each and adding the number to a shared total. After both finish, print how many numbers were processed and the total.

Input

One line of integers.

Output

One line.

Sample 1

Input
1 2 3 4 5
Output
5 15

Sample 2

Input
10
Output
1 10
solution.py
Output appears here
Two Workers Share a Queue · Python practice problem · LearnPy Hub