LearnPy Hub
← Async Basics problems
Medium

An Async Iterator Class

Write a class Ticker(n) with __aiter__ returning self and async def __anext__ that returns 1, 2, …, n (with a tiny sleep) and then raises StopAsyncIteration. Read n and print the values with async for on one line.

Input

One integer n ≥ 1.

Output

One line.

Sample 1

Input
5
Output
1 2 3 4 5

Sample 2

Input
1
Output
1
solution.py
Output appears here
An Async Iterator Class · Python practice problem · LearnPy Hub