Medium
Interleaved Output
Two coroutines run together with gather.
ping prints ping i and pong prints pong i for i = 1..n, each awaiting asyncio.sleep(0) after every print so they take turns.Input
One integer n ≥ 1.
Output
2n lines.
Sample 1
Input
3
Output
ping 1 pong 1 ping 2 pong 2 ping 3 pong 3
Sample 2
Input
1
Output
ping 1 pong 1
Output appears here