LearnPy Hub
← Async Basics problems
Hard

Async Generator

Write an async generator ticks(n) that yields 1..n with a tiny sleep between. Collect them with async for and print them, then their sum.

Input

One integer n ≥ 1.

Output

Two lines.

Sample 1

Input
5
Output
1 2 3 4 5
15

Sample 2

Input
1
Output
1
1
solution.py
Output appears here
Async Generator · Python practice problem · LearnPy Hub